diff --git a/flake.nix b/flake.nix index 87fafb31..70e261a6 100644 --- a/flake.nix +++ b/flake.nix @@ -87,6 +87,7 @@ home-manager.flake = inputs.home-manager; agenix.flake = inputs.agenix; nur.flake = inputs.nur; + guix-overlay.flake = inputs.guix-overlay; }; # Set several binary caches. diff --git a/hosts/ni/default.nix b/hosts/ni/default.nix index 30690ac4..8d0ade99 100644 --- a/hosts/ni/default.nix +++ b/hosts/ni/default.nix @@ -1,9 +1,11 @@ -{ config, pkgs, ... }: +{ config, pkgs, inputs, ... }: { imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix + + inputs.guix-overlay.nixosModules.guix-binary ]; # My custom configuration with my custom modules starts here. @@ -39,6 +41,9 @@ themes.a-happy-gnome.enable = true; }; + # Enable Guix service. + services.guix-binary.enable = true; + # Use the systemd-boot EFI boot loader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; diff --git a/modules/nixos/services/guix.nix b/modules/nixos/services/guix.nix deleted file mode 100644 index e9a716bc..00000000 --- a/modules/nixos/services/guix.nix +++ /dev/null @@ -1,101 +0,0 @@ -{ config, pkgs, lib, ... }: - -let - cfg = config.services.guix; - - buildGuixUser = i: { - "guixbuilder${builtins.toString i}" = { - group = "guixbuild"; - extraGroups = [ "guixbuild" ]; - home = "/var/empty"; - shell = pkgs.nologin; - description = "Guix build user ${builtins.toString i}"; - isSystemUser = true; - }; - }; -in { - options.services.guix = { - enable = lib.mkEnableOption "GNU Guix package manager"; - package = lib.mkOption { - type = lib.types.package; - default = pkgs.guix-binary; - defaultText = "pkgs.guix"; - description = "Package that contains the guix binary and initial store."; - }; - }; - - config = lib.mkIf (cfg.enable) { - environment.systemPackages = [ pkgs.guix-binary ]; - - users = { - extraUsers = lib.fold (a: b: a // b) { } - (builtins.map buildGuixUser (lib.range 1 10)); - extraGroups.guixbuild = { name = "guixbuild"; }; - }; - - # /root/.config/guix/current/lib/systemd/system/guix-daemon.service - systemd.services.guix-daemon = { - enable = true; - description = "Build daemon for GNU Guix"; - serviceConfig = { - ExecStart = - "/var/guix/profiles/per-user/root/current-guix/bin/guix-daemon --build-users-group=guixbuild"; - Environment = [ - "GUIX_LOCPATH=/var/guix/profiles/per-user/root/guix-profile/lib/locale" - "LC_ALL=en_US.utf8" - ]; - RemainAfterExit = "yes"; - - # See . - # Some package builds (for example, go@1.8.1) may require even more than - # 1024 tasks. - TasksMax = "8192"; - }; - wantedBy = [ "multi-user.target" ]; - }; - - system.activationScripts.guix = '' - # copy initial /gnu/store - if [ ! -d /gnu/store ] - then - mkdir -p /gnu - cp -ra ${cfg.package.store}/gnu/store /gnu/ - fi - - # copy initial /var/guix content - if [ ! -d /var/guix ] - then - mkdir -p /var - cp -ra ${cfg.package.var}/var/guix /var/ - fi - - # root profile - if [ ! -d ~root/.config/guix ] - then - mkdir -p ~root/.config/guix - ln -sf /var/guix/profiles/per-user/root/current-guix \ - ~root/.config/guix/current - fi - - # authorize substitutes - GUIX_PROFILE="`echo ~root`/.config/guix/current"; \ - source $GUIX_PROFILE/etc/profile - guix archive --authorize < ~root/.config/guix/current/share/guix/ci.guix.gnu.org.pub - # probably enable after next stable release - # guix archive --authorize < ~root/.config/guix/current/share/guix/bordeaux.guix.gnu.org.pub - ''; - - # you need to relogin for these to execute - environment.shellInit = '' - # Make the Guix command available to users - export PATH="/var/guix/profiles/per-user/root/current-guix/bin:$PATH" - - export GUIX_LOCPATH="$HOME/.guix-profile/lib/locale" - export PATH="$HOME/.guix-profile/bin:$PATH" - export INFOPATH="$HOME/.guix-profile/share/info:$INFOPATH" - - export GUIX_PROFILE="$HOME/.config/guix/current" - test -f $GUIX_PROFILE/etc/profile && . "$GUIX_PROFILE/etc/profile" - ''; - }; -} diff --git a/pkgs/default.nix b/pkgs/default.nix index 57c8abd8..8fa10cc4 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -41,7 +41,6 @@ let callPackage ./gnome-shell-extension-pop-shell.nix { }; guile-config = callPackage ./guile-config.nix { }; guile-hall = callPackage ./guile-hall.nix { }; - guix-binary = callPackage ./guix-binary.nix { }; junction = callPackage ./junction.nix { }; libcs50 = callPackage ./libcs50.nix { }; mopidy-beets = callPackage ./mopidy-beets.nix { }; diff --git a/pkgs/guix-binary.nix b/pkgs/guix-binary.nix deleted file mode 100644 index 71d789d2..00000000 --- a/pkgs/guix-binary.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ stdenv, lib, fetchurl }: - -stdenv.mkDerivation rec { - name = "guix-binary-${version}"; - version = "1.3.0"; - - src = fetchurl { - url = - "https://ftp.gnu.org/gnu/guix/guix-binary-${version}.${stdenv.targetPlatform.system}.tar.xz"; - sha256 = { - "x86_64-linux" = "sha256-xffvtIlHVF5J0tr0jQ+DLzXSqNGfZdqvYHlCWsMnwFA="; - "i686-linux" = "sha256-QHOK7hFh8LmRFK+EnNBNqfDNwQ0ia0lqRiHov9uyG2Q="; - "aarch64-linux" = "sha256-RE9lNs9ZWWNhI6xxjbm4UHFQLkhVVbLYAb8pNpMIEM4="; - }."${stdenv.targetPlatform.system}"; - }; - sourceRoot = "."; - - outputs = [ "out" "store" "var" ]; - phases = [ "unpackPhase" "installPhase" ]; - - installPhase = '' - # copy the /gnu/store content - mkdir -p $store - cp -r gnu $store - - # copy /var content - mkdir -p $var - cp -r var $var - - # link guix binaries - mkdir -p $out/bin - ln -s /var/guix/profiles/per-user/root/current-guix/bin/guix $out/bin/guix - ln -s /var/guix/profiles/per-user/root/current-guix/bin/guix-daemon $out/bin/guix-daemon - ''; - - meta = { - description = "The GNU Guix package manager"; - homepage = "https://www.gnu.org/software/guix/"; - license = lib.licenses.gpl3Plus; - maintainers = with lib.maintainers; [ johnazoidberg mohe2015 ]; - platforms = [ "aarch64-linux" "i686-linux" "x86_64-linux" ]; - }; -}