diff --git a/nix/base-system/flake.nix b/nix/base-system/flake.nix new file mode 100644 index 0000000..d58d946 --- /dev/null +++ b/nix/base-system/flake.nix @@ -0,0 +1,128 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/release-23.05"; + sile-flake.url = "github:sile-typesetter/sile"; + durnitisp-flake.url = "github:zaphar/durnitisp"; + runwhen-flake.url = "github:zaphar/runwhen"; + agenix-flake.url = "github:ryantm/agenix"; + rust-overlay-flake = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + jj-flake.url = "github:martinvonz/jj"; + }; + outputs = { + self, + nixpkgs, + sile-flake, + runwhen-flake, + durnitisp-flake, + rust-overlay-flake, + jj-flake, + agenix-flake, + }: { + systemModule = system: let + runwhen = runwhen-flake.defaultPackage."${system}"; + durnitisp = durnitisp-flake.defaultPackage."${system}"; + rust-overlay = rust-overlay-flake.overlay; + sile = sile-flake.defaultPackage.${system}; + jj = jj-flake.packages."${system}".jujutsu; + age = agenix-flake.packages."${system}".default; + in { config, pkgs, ... }: { + + imports = [ + agenix-flake.nixosModules.default + ]; + + config = { + + nixpkgs.overlays = [ + rust-overlay + ]; + + environment.variables = { + EDITOR="nvim"; + PAGER="less -R"; + }; + + programs = with pkgs; { + neovim.enable = true; + neovim.configure = { + #customRC = (builtins.readFile ../.vimrc); + packages.myVimPackage = with pkgs.vimPlugins; { + start = [ + coc-nvim + nerdtree + vim-nix + coc-rust-analyzer + coc-diagnostic + coc-markdownlint + coc-tslint + coc-explorer + coc-git + coc-vimlsp + coc-python + coc-clangd + coc-go + coc-html + coc-css + coc-yaml + coc-json + vim-toml + hoon-vim + ]; + }; + }; + zsh.enable = true; # default shell on catalina + #zsh.interactiveShellInit = (builtins.readFile ../.zshrc); + }; + environment.systemPackages = (with pkgs; [ + nodejs + tmux + gnumake + # TODO find a version of the julia package that will install + # on darwin and add it as an overlay + python3 + emacs + git + mercurial + bash + curl + wget + jq + spacebar + coreutils + watch + iterm2 + go + htop + colima + qemu + podman + lima + rlwrap + docker-client + google-cloud-sdk + rnix-lsp + nil + alloy6 + jdk + plantuml-c4 + texlive.combined.scheme-basic + nssTools + mkcert + octave + kubo + dotnet-sdk_7 + # TODO add sonic-pi here if it supports the arch + ]) ++ [ + sile + runwhen + durnitisp + jj + age + ]; + }; + }; + }; +} diff --git a/nix/darwin/darwin-configuration.nix b/nix/darwin/darwin-configuration.nix index 325ffc2..093dfdd 100644 --- a/nix/darwin/darwin-configuration.nix +++ b/nix/darwin/darwin-configuration.nix @@ -1,4 +1,4 @@ -{ config, pkgs, inputs, ... }: +{ config, pkgs, ... }: { nix = { @@ -27,94 +27,8 @@ vimAlias = true; }; }) - inputs.rust-overlay ]; - environment.variables = { - EDITOR="nvim"; - PAGER="less -R"; - }; - - programs = with pkgs; { - neovim.enable = true; - neovim.configure = { - customRC = (builtins.readFile ../../.vimrc); - packages.myVimPackage = with pkgs.vimPlugins; { - start = [ - coc-nvim - nerdtree - vim-nix - coc-rust-analyzer - coc-diagnostic - coc-markdownlint - coc-tslint - coc-explorer - coc-git - coc-vimlsp - coc-python - coc-clangd - coc-go - coc-html - coc-css - coc-yaml - coc-json - vim-toml - hoon-vim - ]; - }; - }; - zsh.enable = true; # default shell on catalina - zsh.interactiveShellInit = (builtins.readFile ../../.zshrc); - }; - - # List packages installed in system profile. To search by name, run: - # $ nix-env -qaP | grep wget - environment.systemPackages = - with pkgs; [ - nodejs - tmux - gnumake - # TODO find a version of the julia package that will install - # on darwin and add it as an overlay - python3 - emacs - git - mercurial - bash - curl - wget - jq - spacebar - coreutils - watch - iterm2 - go - htop - colima - qemu - podman - lima - rlwrap - docker-client - google-cloud-sdk - rnix-lsp - nil - alloy6 - jdk - plantuml-c4 - texlive.combined.scheme-basic - nssTools - mkcert - octave - kubo - inputs.sile - inputs.runwhen - inputs.durnitisp - inputs.jj - inputs.age - # TODO add sonic-pi here if it supports the arch - ]; - launchd.user.agents.ipfs = { serviceConfig = { ProgramArguments = [ diff --git a/nix/darwin/flake.lock b/nix/darwin/flake.lock index 500b34a..396db54 100644 --- a/nix/darwin/flake.lock +++ b/nix/darwin/flake.lock @@ -1,16 +1,17 @@ { "nodes": { - "agenix": { + "agenix-flake": { "inputs": { "darwin": "darwin", + "home-manager": "home-manager", "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1682101079, - "narHash": "sha256-MdAhtjrLKnk2uiqun1FWABbKpLH090oeqCSiWemtuck=", + "lastModified": 1684153753, + "narHash": "sha256-PVbWt3qrjYAK+T5KplFcO+h7aZWfEj1UtyoKlvcDxh0=", "owner": "ryantm", "repo": "agenix", - "rev": "2994d002dcff5353ca1ac48ec584c7f6589fe447", + "rev": "db5637d10f797bb251b94ef9040b237f4702cde3", "type": "github" }, "original": { @@ -19,10 +20,32 @@ "type": "github" } }, + "base-system": { + "inputs": { + "agenix-flake": "agenix-flake", + "durnitisp-flake": "durnitisp-flake", + "jj-flake": "jj-flake", + "nixpkgs": "nixpkgs_4", + "runwhen-flake": "runwhen-flake", + "rust-overlay-flake": "rust-overlay-flake", + "sile-flake": "sile-flake" + }, + "locked": { + "lastModified": 1, + "narHash": "sha256-wsNz9Dl40+AXhNPHEuWxGtczgPQxCJ3P08iRdKu06+o=", + "path": "/nix/store/r8nbb698wy9pvybh7207jl7zv8fj19k6-source/nix/base-system", + "type": "path" + }, + "original": { + "path": "/nix/store/r8nbb698wy9pvybh7207jl7zv8fj19k6-source/nix/base-system", + "type": "path" + } + }, "darwin": { "inputs": { "nixpkgs": [ - "agenix", + "base-system", + "agenix-flake", "nixpkgs" ] }, @@ -43,9 +66,7 @@ }, "darwin_2": { "inputs": { - "nixpkgs": [ - "nixpkgs" - ] + "nixpkgs": "nixpkgs_8" }, "locked": { "lastModified": 1648278671, @@ -61,18 +82,18 @@ "type": "github" } }, - "durnitisp": { + "durnitisp-flake": { "inputs": { "flake-compat": "flake-compat", "flake-utils": "flake-utils", "naersk": "naersk" }, "locked": { - "lastModified": 1646347522, - "narHash": "sha256-9FmfD+maojx6WXGqnfznBi6noeqZJVqbNAahdarmalo=", + "lastModified": 1678814232, + "narHash": "sha256-d0F2PueBTOPiBJyp4n2fVuywvqR7DiObWRdVVTbrYq4=", "owner": "zaphar", "repo": "durnitisp", - "rev": "26ac114f8855b1206c9a9df4bf461a1a0b643ce5", + "rev": "5341153a8621ce287e5817ecc15bc7e269dda4d4", "type": "github" }, "original": { @@ -145,12 +166,15 @@ } }, "flake-utils_2": { + "inputs": { + "systems": "systems" + }, "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "lastModified": 1687171271, + "narHash": "sha256-BJlq+ozK2B1sJDQXS3tzJM5a+oVZmi1q0FlBK/Xqv7M=", "owner": "numtide", "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "rev": "abfb11bd1aec8ced1c9bb9adfe68018230f4fb3c", "type": "github" }, "original": { @@ -190,12 +214,15 @@ } }, "flake-utils_5": { + "inputs": { + "systems": "systems_2" + }, "locked": { - "lastModified": 1637014545, - "narHash": "sha256-26IZAc5yzlD9FlDT54io1oqG/bBoyka+FJk5guaX4x4=", + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", "owner": "numtide", "repo": "flake-utils", - "rev": "bba5dcc8e0b20ab664967ad83d24d64cb64ec4f4", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", "type": "github" }, "original": { @@ -206,7 +233,7 @@ }, "flake-utils_6": { "inputs": { - "systems": "systems" + "systems": "systems_3" }, "locked": { "lastModified": 1681202837, @@ -225,6 +252,7 @@ "gitignore": { "inputs": { "nixpkgs": [ + "base-system", "sile-flake", "nixpkgs" ] @@ -243,18 +271,40 @@ "type": "github" } }, - "jj": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "base-system", + "agenix-flake", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1682203081, + "narHash": "sha256-kRL4ejWDhi0zph/FpebFYhzqlOBrk0Pl3dzGEKSAlEw=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "32d3e39c491e2f91152c84f8ad8b003420eab0a1", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "jj-flake": { "inputs": { "flake-utils": "flake-utils_2", "nixpkgs": "nixpkgs_3", "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1686876341, - "narHash": "sha256-JuZOBQzQc57GZ/yk0b6kwFIBuiWHzajuQ4/l88/4msk=", + "lastModified": 1687805703, + "narHash": "sha256-/NsUv6EgH1FfgqyklpnHtUjfuGhMIMow0h1Iqqpf3QY=", "owner": "martinvonz", "repo": "jj", - "rev": "8b0c01d1e9afbc2fe4a12113436e9192a4e5dd33", + "rev": "5e6dd17ed97a747c8615490f4fe3cdb8ed0ae238", "type": "github" }, "original": { @@ -284,11 +334,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1639947939, - "narHash": "sha256-pGsM8haJadVP80GFq4xhnSpNitYNQpaXk4cnA796Cso=", + "lastModified": 1671096816, + "narHash": "sha256-ezQCsNgmpUHdZANDCILm3RvtO1xH8uujk/+EqNvzIOg=", "owner": "nix-community", "repo": "naersk", - "rev": "2fc8ce9d3c025d59fee349c1f80be9785049d653", + "rev": "d998160d6a076cfe8f9741e56aeec7e267e3e114", "type": "github" }, "original": { @@ -333,11 +383,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1645937171, - "narHash": "sha256-n9f9GZBNMe8UMhcgmmaXNObkH01jjgp7INMrUgBgcy4=", + "lastModified": 1678724065, + "narHash": "sha256-MjeRjunqfGTBGU401nxIjs7PC9PZZ1FBCZp/bRB3C2M=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "22dc22f8cedc58fcb11afe1acb08e9999e78be9c", + "rev": "b8afc8489dc96f29f69bec50fdc51e27883f89c1", "type": "github" }, "original": { @@ -347,11 +397,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1683236849, - "narHash": "sha256-Y7PNBVLOBvZrmrFmHgXUBUA1lM72tl6JGIn1trOeuyE=", + "lastModified": 1687103638, + "narHash": "sha256-dwy/TK6Db5W7ivcgmcxUykhFwodIg0jrRzOFt7H5NUc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "374ffe54403c3c42d97a513ac7a14ce1b5b86e30", + "rev": "91430887645a0953568da2f3e9a3a3bb0a0378ac", "type": "github" }, "original": { @@ -361,11 +411,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1686526929, - "narHash": "sha256-ybQ4GDx/AViKJfeu2PUWvxxlGcmVHVY15zay849i6dg=", + "lastModified": 1687809362, + "narHash": "sha256-e72RNXWY3ICo6/pg51WzTTUAHAH/BFeyYUIc2HrVGgU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "5f6396e85487aa59c801da5f7c87ac20098b2fa8", + "rev": "6b6afd2c68c6ecc0fe055b8b9ea2dbbc30219836", "type": "github" }, "original": { @@ -420,19 +470,44 @@ "type": "github" } }, - "root": { - "inputs": { - "agenix": "agenix", - "darwin": "darwin_2", - "durnitisp": "durnitisp", - "jj": "jj", - "nixpkgs": "nixpkgs_4", - "runwhen": "runwhen", - "rust-overlay": "rust-overlay_3", - "sile-flake": "sile-flake" + "nixpkgs_8": { + "locked": { + "lastModified": 1687701825, + "narHash": "sha256-aMC9hqsf+4tJL7aJWSdEUurW2TsjxtDcJBwM9Y4FIYM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "07059ee2fa34f1598758839b9af87eae7f7ae6ea", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" } }, - "runwhen": { + "nixpkgs_9": { + "locked": { + "lastModified": 1686526929, + "narHash": "sha256-ybQ4GDx/AViKJfeu2PUWvxxlGcmVHVY15zay849i6dg=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "5f6396e85487aa59c801da5f7c87ac20098b2fa8", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "release-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "base-system": "base-system", + "darwin": "darwin_2", + "nixpkgs": "nixpkgs_9" + } + }, + "runwhen-flake": { "inputs": { "flake-compat": "flake-compat_2", "flake-utils": "flake-utils_3", @@ -441,16 +516,15 @@ "rust-overlay": "rust-overlay_2" }, "locked": { - "lastModified": 1654052497, - "narHash": "sha256-I+cnrJvCwLGB2Gq6//eey99/lB2KsAwzdVjLca1DOc8=", + "lastModified": 1661365192, + "narHash": "sha256-5f700J5W4bGpuZd4PieEDP4WZjXYfL+YjKPsrRqfvrA=", "owner": "zaphar", "repo": "runwhen", - "rev": "079ec6e412f14e784c408bc0996f0276db49b922", + "rev": "9829d0f38f8ccc91428b566993b8a010d9ef9ca5", "type": "github" }, "original": { "owner": "zaphar", - "ref": "v0.0.5", "repo": "runwhen", "type": "github" } @@ -458,20 +532,44 @@ "rust-overlay": { "inputs": { "flake-utils": [ - "jj", + "base-system", + "jj-flake", "flake-utils" ], "nixpkgs": [ - "jj", + "base-system", + "jj-flake", "nixpkgs" ] }, "locked": { - "lastModified": 1674095406, - "narHash": "sha256-RexH/1rZTiX4OhdYkuJP3MuANJ+JRgoLKL60iHm//T0=", + "lastModified": 1687141659, + "narHash": "sha256-ckvEuxejYmFTyFF0u9CWV8h5u+ubuxA7vYrOw/GXRXg=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "5f7315b9800e2e500e6834767a57e39f7dbfd495", + "rev": "86302751ef371597d48951983e1a2f04fe78d4ff", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "rust-overlay-flake": { + "inputs": { + "flake-utils": "flake-utils_5", + "nixpkgs": [ + "base-system", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1687746941, + "narHash": "sha256-wsSRCmPQ1+uXsDNnEH2mN4ZVtHHpfavA4FrQnCb5A44=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "b91d162355e88de89b379f3d6a459ade92704474", "type": "github" }, "original": { @@ -484,28 +582,8 @@ "inputs": { "flake-utils": "flake-utils_4", "nixpkgs": [ - "runwhen", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1650162887, - "narHash": "sha256-e23LlN7NQGxrsSWNNAjyvrWlZ3kwFSav9kXbayibKWc=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "26b570500cdd7a359526524e9abad341891122a6", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "rust-overlay_3": { - "inputs": { - "flake-utils": "flake-utils_5", - "nixpkgs": [ + "base-system", + "runwhen-flake", "nixpkgs" ] }, @@ -532,11 +610,11 @@ "nixpkgs": "nixpkgs_7" }, "locked": { - "lastModified": 1685738177, - "narHash": "sha256-FbLjS7LvgvwZ84F7x79J8YIbqA/VI5+4XOqoonDqzDU=", + "lastModified": 1687444516, + "narHash": "sha256-2W3+qUZFGjbgIhCv6lXOulkwAWh6oqELThqRz8VkdjE=", "owner": "sile-typesetter", "repo": "sile", - "rev": "c7320e450ff0319b920fef29af0eb59d79f2fbc5", + "rev": "faf0b57f525cb8a6d9a4f2fa3b50888666dd7fd5", "type": "github" }, "original": { @@ -559,6 +637,36 @@ "repo": "default", "type": "github" } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/nix/darwin/flake.nix b/nix/darwin/flake.nix index 8325c6e..342f360 100644 --- a/nix/darwin/flake.nix +++ b/nix/darwin/flake.nix @@ -3,27 +3,13 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/release-23.05"; darwin.url = "github:lnl7/nix-darwin"; - darwin.inputs.nixpkgs.follows = "nixpkgs"; - sile-flake.url = "github:sile-typesetter/sile"; - runwhen.url = "github:zaphar/runwhen?ref=v0.0.5"; - durnitisp.url = "github:zaphar/durnitisp"; - agenix.url = "github:ryantm/agenix"; - rust-overlay = { - url = "github:oxalica/rust-overlay"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - jj.url = "github:martinvonz/jj"; + base-system.url = "../base-system/"; }; outputs = {self, nixpkgs, - sile-flake, darwin, - runwhen, - durnitisp, - rust-overlay, - jj, - agenix, + base-system, }: let forSystem = (system: @@ -33,17 +19,10 @@ darwin.lib.darwinSystem rec { inherit system; modules = [ + (base-system.systemModule system) ./darwin-configuration.nix - agenix.nixosModules.default + ]; - inputs = { - runwhen = runwhen.defaultPackage."${system}"; - durnitisp = durnitisp.defaultPackage."${system}"; - rust-overlay = rust-overlay.overlay; - sile = sile-flake.defaultPackage.${system}; - jj = jj.packages."${system}".jujutsu; - age = agenix.packages."${system}".default; - }; }); in {