diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c0bcec..e4184f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,6 +46,13 @@ jobs: rm -f flake.lock nix flake lock nix flake check + + # don't check custom conf relocation on darwin while we work with nix-darwin to make this a good experience + if [ "$(nix eval --raw --impure --expr 'builtins.currentSystem')" = "x86_64-linux" ]; then + # ensure relocating nix.conf to nix.custom.conf worked + nix build .#custom-conf --out-link /tmp/custom-conf + grep --quiet nix-community /tmp/custom-conf/etc/nix/nix.custom.conf + fi - run: | set -eux diff --git a/modules/nixos.nix b/modules/nixos.nix index 657945d..44d7294 100644 --- a/modules/nixos.nix +++ b/modules/nixos.nix @@ -15,6 +15,10 @@ in ]; config = { + # Push the user's nix.conf into /etc/nix/nix.custom.conf, + # leaving determinate-nixd to manage /etc/nix/nix.conf + environment.etc."nix/nix.conf".target = "nix/nix.custom.conf"; + environment.systemPackages = [ inputs.self.packages.${pkgs.stdenv.system}.default ]; diff --git a/tests/flake.nix b/tests/flake.nix index 2c77cdb..2332642 100644 --- a/tests/flake.nix +++ b/tests/flake.nix @@ -6,37 +6,81 @@ url = "github:LnL7/nix-darwin/nix-darwin-24.11"; inputs.nixpkgs.follows = "nixpkgs"; }; - home-manager = { - url = "github:nix-community/home-manager/release-24.05"; - inputs.nixpkgs.follows = "nixpkgs"; - }; }; - outputs = { nixpkgs, determinate, home-manager, nix-darwin, ... }: { - checks.x86_64-linux.nixos = (nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - determinate.nixosModules.default + outputs = + { + nixpkgs, + determinate, + nix-darwin, + ... + }: + let + mkNixOS = { - fileSystems."/" = { - device = "/dev/bogus"; - fsType = "ext4"; - }; - boot.loader.grub.devices = [ "/dev/bogus" ]; - system.stateVersion = "24.11"; - } - ]; - }).config.system.build.toplevel; - - checks.aarch64-darwin.nix-darwin = (nix-darwin.lib.darwinSystem { - system = "aarch64-darwin"; + modules ? [ ], + }: + (nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + determinate.nixosModules.default + { + fileSystems."/" = { + device = "/dev/bogus"; + fsType = "ext4"; + }; + boot.loader.grub.devices = [ "/dev/bogus" ]; + system.stateVersion = "24.11"; + } + ] ++ modules; + }).config.system.build.toplevel; - modules = [ - determinate.darwinModules.default + mkNixDarwin = { - system.stateVersion = 5; - } - ]; - }).system; - }; + modules ? [ ], + }: + (nix-darwin.lib.darwinSystem { + system = "aarch64-darwin"; + + modules = [ + determinate.darwinModules.default + { + system.stateVersion = 5; + } + ] ++ modules; + }).system; + in + { + packages.x86_64-linux = { + default = mkNixOS { }; + + custom-conf = mkNixOS { + modules = [ + { + nix.settings = { + substituters = [ "https://nix-community.cachix.org" ]; + trusted-substituters = [ "https://nix-community.cachix.org" ]; + trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ]; + }; + } + ]; + }; + }; + + packages.aarch64-darwin = { + default = mkNixDarwin { }; + + # custom-conf = mkNixDarwin { + # modules = [ + # { + # nix.settings = { + # substituters = [ "https://nix-community.cachix.org" ]; + # trusted-substituters = [ "https://nix-community.cachix.org" ]; + # trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ]; + # }; + # } + # ]; + # }; + }; + }; }