diff --git a/darwin-configuration.nix b/darwin-configuration.nix new file mode 100644 index 0000000..76dc6b6 --- /dev/null +++ b/darwin-configuration.nix @@ -0,0 +1,8 @@ +{ ... }: + +{ + imports = [ + profiles/darwin + hosts/work + ]; +} diff --git a/flake.lock b/flake.lock index 73255af..c5464f9 100644 --- a/flake.lock +++ b/flake.lock @@ -18,6 +18,27 @@ "type": "github" } }, + "darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1650976225, + "narHash": "sha256-PGM65SQHS63Dd5MmLJo3GJsZP9lJVZmpWxluQoG1Dt8=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "bb3baef6e115ae47bc2ab4973bd3a486488485b0", + "type": "github" + }, + "original": { + "owner": "lnl7", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -74,6 +95,7 @@ "root": { "inputs": { "agenix": "agenix", + "darwin": "darwin", "home-manager": "home-manager", "nixpkgs": "nixpkgs_2" } diff --git a/flake.nix b/flake.nix index 05083f4..8bd302a 100644 --- a/flake.nix +++ b/flake.nix @@ -11,6 +11,10 @@ url = "github:nix-community/home-manager/release-21.11"; inputs.nixpkgs.follows = "nixpkgs"; }; + darwin = { + url = "github:lnl7/nix-darwin/master"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = inputs: @@ -18,7 +22,7 @@ mods = hostname: [ inputs.agenix.nixosModule ./modules - ./profiles/base + ./profiles/linux ./hosts/${hostname} inputs.home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; @@ -33,6 +37,12 @@ modules = mods name; }; + darwinMods = hostname: [ + inputs.agenix.nixosModule + ./profiles/darwin + ./hosts/${hostname} + ]; + in { nixosConfigurations = { "2maccabees" = machine "aarch64-linux" "2maccabees"; @@ -42,6 +52,15 @@ "iso" = machine "x86_64-linux" "iso"; }; + darwinConfigurations = { + "C02G48H8MD6R" = inputs.darwin.lib.darwinSystem { + system = "x86_64-darwin"; + specialArgs = inputs; + modules = darwinMods "work"; + }; + }; + defaultPackage."x86_64-linux" = inputs.self.nixosConfigurations.iso.config.system.build.isoImage; + defaultPackage."x86_64-darwin" = inputs.self.darwinConfigurations.C02G48H8MD6R.system; }; } diff --git a/hosts/work/default.nix b/hosts/work/default.nix new file mode 100644 index 0000000..d796592 --- /dev/null +++ b/hosts/work/default.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + vim + wget + ]; + + services.nix-daemon.enable = true; +} diff --git a/profiles/darwin/default.nix b/profiles/darwin/default.nix new file mode 100644 index 0000000..334cede --- /dev/null +++ b/profiles/darwin/default.nix @@ -0,0 +1,10 @@ +{ ... }: + +{ + imports = [ + ../shared + ]; + system.stateVersion = 4; + programs.zsh.enable = true; + programs.bash.enable = true; +} diff --git a/profiles/base/default.nix b/profiles/linux/default.nix similarity index 96% rename from profiles/base/default.nix rename to profiles/linux/default.nix index 644d95f..a8feb7b 100755 --- a/profiles/base/default.nix +++ b/profiles/linux/default.nix @@ -2,13 +2,16 @@ { imports = [ - ./nix.nix + ../shared ./programs.nix ./syncthing.nix ./xonsh.nix ]; + # Use hardlinking instead of copying when possible + nix.autoOptimiseStore = true; + # I am a fan of network manager, myself networking.networkmanager.enable = true; diff --git a/profiles/base/programs.nix b/profiles/linux/programs.nix similarity index 100% rename from profiles/base/programs.nix rename to profiles/linux/programs.nix diff --git a/profiles/base/syncthing.nix b/profiles/linux/syncthing.nix similarity index 100% rename from profiles/base/syncthing.nix rename to profiles/linux/syncthing.nix diff --git a/profiles/base/xonsh.nix b/profiles/linux/xonsh.nix similarity index 100% rename from profiles/base/xonsh.nix rename to profiles/linux/xonsh.nix diff --git a/profiles/shared/default.nix b/profiles/shared/default.nix new file mode 100644 index 0000000..1e6d63c --- /dev/null +++ b/profiles/shared/default.nix @@ -0,0 +1,7 @@ +{ ... }: + +{ + imports = [ + ./nix.nix + ]; +} diff --git a/profiles/base/nix.nix b/profiles/shared/nix.nix similarity index 80% rename from profiles/base/nix.nix rename to profiles/shared/nix.nix index 0b23255..1c9dc17 100644 --- a/profiles/base/nix.nix +++ b/profiles/shared/nix.nix @@ -11,9 +11,6 @@ experimental-features = nix-command flakes min-free = ${toString (1024 * 1024 * 1024) } max-free = ${toString (5 * 1024 * 1024 * 1024) } ''; - - # Use hardlinking instead of copying when possible - autoOptimiseStore = true; }; nixpkgs.config.allowUnfree = true; } diff --git a/result b/result new file mode 120000 index 0000000..8a12386 --- /dev/null +++ b/result @@ -0,0 +1 @@ +/nix/store/crvk81fyaw1jhqlylxnjcd2y90xpgalr-darwin-system-21.11.20220418.7b38b03+darwin4.bb3baef \ No newline at end of file