refactor(flake)!: deduplicate code in configurations
flake module
Pass around `perSystem`'s `pkgs` instances to the system configurations Some more refactoring in `configurations`' `mkHost` functions Also start using `home-manager`'s `useGlobalPkgs` option Also use `mkShellNoCC` for default `devShell` Also `nix flake update`
This commit is contained in:
parent
eeae48b5d8
commit
e3b1539b41
19 changed files with 183 additions and 246 deletions
54
flake.lock
54
flake.lock
|
@ -37,11 +37,11 @@
|
||||||
"pre-commit-hooks": "pre-commit-hooks"
|
"pre-commit-hooks": "pre-commit-hooks"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1721071152,
|
"lastModified": 1721402988,
|
||||||
"narHash": "sha256-GoshD2O4dDNuGPPK4AiVCkM38j9/8OImYudY0zjFDcc=",
|
"narHash": "sha256-O5j5y5gpssVF5FNsSF7joTyrlW//LpwyLk6yBWgQ0VE=",
|
||||||
"owner": "oddlama",
|
"owner": "oddlama",
|
||||||
"repo": "agenix-rekey",
|
"repo": "agenix-rekey",
|
||||||
"rev": "d63898728266e3a30f5367a0efbbfaedf9cf8041",
|
"rev": "3f1c787e2092d9c13142ae7572cc1c52b68f1c4c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -175,11 +175,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1721266288,
|
"lastModified": 1721417620,
|
||||||
"narHash": "sha256-MsyTzXu9CJVcBr44ct8ILKF/Ro7VlF+tVZTylzAoXSs=",
|
"narHash": "sha256-6q9b1h8fI3hXg2DG6/vrKWCeG8c5Wj2Kvv22RCgedzg=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "disko",
|
"repo": "disko",
|
||||||
"rev": "e8e8d9a3a9c1d0e654ccda7834bf0288a9d15c47",
|
"rev": "bec6e3cde912b8acb915fecdc509eda7c973fb42",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -674,11 +674,11 @@
|
||||||
},
|
},
|
||||||
"hardware": {
|
"hardware": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1721331912,
|
"lastModified": 1721413321,
|
||||||
"narHash": "sha256-h2yaU+QEU4pHxMySHPIsRV2T/pihDHnrXBca8BY6xgc=",
|
"narHash": "sha256-0GdiQScDceUrVGbxYpV819LHesK3szHOhJ09e6sgES4=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixos-hardware",
|
"repo": "nixos-hardware",
|
||||||
"rev": "bb90787ea034c8b9035dfcfc9b4dc23898d414be",
|
"rev": "ab165a8a6cd12781d76fe9cbccb9e975d0fb634f",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -823,11 +823,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1721281012,
|
"lastModified": 1721368131,
|
||||||
"narHash": "sha256-km+EYinh23cAztAFDi2dX/Dqx9NN9jjmyFAII1CZB4Y=",
|
"narHash": "sha256-dvDYa+Z2qZHTibmeUbKKIpR2jONO4UPbyHiDgYhgoMQ=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "neovim-nightly-overlay",
|
"repo": "neovim-nightly-overlay",
|
||||||
"rev": "bc1d14af6c0834c68b09fdfd588b4e82bd8177d1",
|
"rev": "d9fcc47baa026c7df9a9789d5e825b4f13a9239a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -839,11 +839,11 @@
|
||||||
"neovim-src": {
|
"neovim-src": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1721260040,
|
"lastModified": 1721316387,
|
||||||
"narHash": "sha256-Aj1WC8RCOx000R97YPzocO3QGTaj0YVhGF1fDxWwqWo=",
|
"narHash": "sha256-qPgppLqmnd0OnHLMo4cGPZSUyLbcw9nThWO4sJC8bWI=",
|
||||||
"owner": "neovim",
|
"owner": "neovim",
|
||||||
"repo": "neovim",
|
"repo": "neovim",
|
||||||
"rev": "185b22720de9156393ddc22c2c59dc3eb46b8d97",
|
"rev": "f61efe3fe77c9a517dccb9fd5ff7f16c0660ced4",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -1119,11 +1119,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1721138476,
|
"lastModified": 1721379653,
|
||||||
"narHash": "sha256-+W5eZOhhemLQxelojLxETfbFbc19NWawsXBlapYpqIA=",
|
"narHash": "sha256-8MUgifkJ7lkZs3u99UDZMB4kbOxvMEXQZ31FO3SopZ0=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "ad0b5eed1b6031efaed382844806550c3dcb4206",
|
"rev": "1d9c2c9b3e71b9ee663d11c5d298727dace8d374",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -1221,11 +1221,11 @@
|
||||||
},
|
},
|
||||||
"nur": {
|
"nur": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1721335575,
|
"lastModified": 1721472350,
|
||||||
"narHash": "sha256-dry8Y8MwACIdIBVFDOFQGpKd8PmEIPv9Ej0UdrdOlG8=",
|
"narHash": "sha256-XFGmZB6GhnYsTOFouj60lc40OkZxpdk6mL2nTT0fIkU=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "NUR",
|
"repo": "NUR",
|
||||||
"rev": "6e46867fdecc920a1de55dc1e553a16f54e2d2ee",
|
"rev": "b4365ef44d92f9f6bd6ad3e54117d1719ebd2c57",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -1651,11 +1651,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1721304636,
|
"lastModified": 1721390978,
|
||||||
"narHash": "sha256-vpincauiWXBtlQLzGQNjAGlOjfOuh+nb30AUAsnMhWs=",
|
"narHash": "sha256-he5AUpgwVAT/VXtkUOiMsz5cYblXw2qAGs1wADW9ji8=",
|
||||||
"owner": "mitchellh",
|
"owner": "mitchellh",
|
||||||
"repo": "zig-overlay",
|
"repo": "zig-overlay",
|
||||||
"rev": "a88326d1947156a6ad22b00d44fb3f1bf0a98673",
|
"rev": "c7615d701b2a5355a3f3013918b6b945c394e791",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -1677,11 +1677,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1721153775,
|
"lastModified": 1721428418,
|
||||||
"narHash": "sha256-kReih1LP5I9J0P+ByAOKNv/d4re0P/bH2AD6InGjN1U=",
|
"narHash": "sha256-4CLofMcvvunlfZ0irCjEWCzetMMwuBUaski2qwNtsjk=",
|
||||||
"owner": "zigtools",
|
"owner": "zigtools",
|
||||||
"repo": "zls",
|
"repo": "zls",
|
||||||
"rev": "41dae221fab979b3764e9191d8126e09625b0bb2",
|
"rev": "b9e17146ba64d683fed0cb07156ec6052207f4d4",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -164,7 +164,7 @@
|
||||||
apps = import ./apps { inherit pkgs; };
|
apps = import ./apps { inherit pkgs; };
|
||||||
|
|
||||||
# Dev Shells (`nix develop`)
|
# Dev Shells (`nix develop`)
|
||||||
devShells = import ./shells { inherit pkgs inputs outputs; };
|
devShells = import ./shells { inherit pkgs inputs; };
|
||||||
|
|
||||||
# Formatter (`nix fmt`)
|
# Formatter (`nix fmt`)
|
||||||
formatter = pkgs.nixpkgs-fmt;
|
formatter = pkgs.nixpkgs-fmt;
|
||||||
|
@ -175,12 +175,12 @@
|
||||||
|
|
||||||
# Templates
|
# Templates
|
||||||
templates = import ./templates {
|
templates = import ./templates {
|
||||||
inherit inputs outputs;
|
inherit inputs;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Overlays
|
# Overlays
|
||||||
overlays = import ./overlays {
|
overlays = import ./overlays {
|
||||||
inherit inputs outputs;
|
inherit inputs;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -14,32 +14,6 @@
|
||||||
./nvim.nix
|
./nvim.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
nixpkgs = {
|
|
||||||
# You can add overlays here
|
|
||||||
overlays = [
|
|
||||||
# If you want to use overlays your own flake exports (from overlays dir):
|
|
||||||
# outputs.overlays.modifications
|
|
||||||
# outputs.overlays.additions
|
|
||||||
|
|
||||||
# Or overlays exported from other flakes:
|
|
||||||
# neovim-nightly-overlay.overlays.default
|
|
||||||
|
|
||||||
# Or define it inline, for example:
|
|
||||||
# (final: prev: {
|
|
||||||
# hi = final.hello.overrideAttrs (oldAttrs: {
|
|
||||||
# patches = [ ./change-hello-to-hi.patch ];
|
|
||||||
# });
|
|
||||||
# })
|
|
||||||
];
|
|
||||||
# Configure your nixpkgs instance
|
|
||||||
config = {
|
|
||||||
# Disable if you don't want unfree packages
|
|
||||||
allowUnfree = true;
|
|
||||||
# Workaround for https://github.com/nix-community/home-manager/issues/2942
|
|
||||||
allowUnfreePredicate = (_: true);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# TODO: Set your username
|
# TODO: Set your username
|
||||||
home = {
|
home = {
|
||||||
username = "your-username";
|
username = "your-username";
|
||||||
|
|
|
@ -8,10 +8,21 @@
|
||||||
# Auto upgrade nix package and the daemon service.
|
# Auto upgrade nix package and the daemon service.
|
||||||
services.nix-daemon.enable = true;
|
services.nix-daemon.enable = true;
|
||||||
|
|
||||||
nix = {
|
nix = let
|
||||||
|
flakeInputs = lib.filterAttrs (lib.const (lib.isType "flake")) inputs;
|
||||||
|
in {
|
||||||
# Ensure we can work with flakes
|
# Ensure we can work with flakes
|
||||||
|
# NOTE: run `sudo -i nix-env --uninstall nix` to uninstall the global `nix`
|
||||||
package = pkgs.nixVersions.monitored.latest;
|
package = pkgs.nixVersions.monitored.latest;
|
||||||
|
|
||||||
|
# This will add each flake input as a registry
|
||||||
|
# To make nix3 commands consistent with your flake
|
||||||
|
registry = lib.mapAttrs (_: value: { flake = value; }) flakeInputs;
|
||||||
|
|
||||||
|
# This will additionally add your inputs to the system's legacy channels
|
||||||
|
# Making legacy nix commands consistent as well, awesome!
|
||||||
|
nixPath = lib.mapAttrsToList (key: value: "${key}=flake:${key}") flakeInputs;
|
||||||
|
|
||||||
# extraOptions = ''
|
# extraOptions = ''
|
||||||
# # Enable flakes and new 'nix' command
|
# # Enable flakes and new 'nix' command
|
||||||
# experimental-features = nix-command flakes
|
# experimental-features = nix-command flakes
|
||||||
|
@ -24,15 +35,6 @@
|
||||||
# keep-derivations = true
|
# keep-derivations = true
|
||||||
# '';
|
# '';
|
||||||
|
|
||||||
# registry.nixpkgs.flake = inputs.nixpkgs;
|
|
||||||
# registry =
|
|
||||||
# lib.mapAttrs'
|
|
||||||
# (name: value:
|
|
||||||
# {
|
|
||||||
# name = name;
|
|
||||||
# value = { flake = value; };
|
|
||||||
# })
|
|
||||||
# inputs;
|
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
# Enable flakes and new 'nix' command
|
# Enable flakes and new 'nix' command
|
||||||
|
@ -89,8 +91,7 @@
|
||||||
programs.zsh.enable = true; # default shell on catalina
|
programs.zsh.enable = true; # default shell on catalina
|
||||||
|
|
||||||
# Fonts
|
# Fonts
|
||||||
fonts.fontDir.enable = true;
|
fonts.packages = with pkgs; [
|
||||||
fonts.fonts = with pkgs; [
|
|
||||||
(nerdfonts.override { fonts = [ "FiraCode" ]; })
|
(nerdfonts.override { fonts = [ "FiraCode" ]; })
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -7,14 +7,6 @@
|
||||||
stateVersion = "23.05";
|
stateVersion = "23.05";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Add custom overlays
|
|
||||||
nixpkgs = {
|
|
||||||
overlays = builtins.attrValues outputs.overlays ++ [
|
|
||||||
inputs.neovim-nightly-overlay.overlays.default
|
|
||||||
inputs.zig-overlay.overlays.default
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Set env vars
|
# Set env vars
|
||||||
home.sessionVariables = {
|
home.sessionVariables = {
|
||||||
EDITOR = "nvim";
|
EDITOR = "nvim";
|
||||||
|
@ -40,18 +32,33 @@
|
||||||
|
|
||||||
# Neovim
|
# Neovim
|
||||||
neovim
|
neovim
|
||||||
|
# (neovim.overrideAttrs (oldAttrs: {
|
||||||
|
# lua = luajitcoroutineclone;
|
||||||
|
# }))
|
||||||
|
(pkgs.writeShellScriptBin "lua" "exec -a $0 ${luajitPackages.nlua}/bin/nlua $@")
|
||||||
|
# luajitPackages.nlua
|
||||||
fennel
|
fennel
|
||||||
fennel-language-server
|
# fennel-language-server
|
||||||
|
fennel-ls
|
||||||
git
|
git
|
||||||
gh
|
gh
|
||||||
|
|
||||||
|
# (gnumake.override { guileSupport = true; })
|
||||||
|
gnumake
|
||||||
|
|
||||||
|
# # Emacs
|
||||||
|
# (emacs-unstable.override {
|
||||||
|
# withGTK3 = true;
|
||||||
|
# :
|
||||||
|
# })
|
||||||
|
|
||||||
# Dhall
|
# Dhall
|
||||||
dhall
|
# dhall
|
||||||
# dhall-lsp-server
|
# dhall-lsp-server
|
||||||
|
|
||||||
# Circom
|
# Circom
|
||||||
circom
|
# circom
|
||||||
circom-lsp
|
# circom-lsp
|
||||||
|
|
||||||
# Nix
|
# Nix
|
||||||
nil
|
nil
|
||||||
|
@ -61,6 +68,9 @@
|
||||||
# Mail
|
# Mail
|
||||||
# himalaya
|
# himalaya
|
||||||
|
|
||||||
|
# Java
|
||||||
|
graalvm-ce
|
||||||
|
|
||||||
# SSH and GPG
|
# SSH and GPG
|
||||||
openssh
|
openssh
|
||||||
gnupg
|
gnupg
|
||||||
|
@ -99,8 +109,27 @@
|
||||||
wezterm = {
|
wezterm = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
|
spotify = {
|
||||||
|
enable = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# programs.git = {
|
||||||
|
# enable = true;
|
||||||
|
# userName = "reo101";
|
||||||
|
# # userEmail = "pavel.atanasov@limechain.tech";
|
||||||
|
# userEmail = "pavel.atanasov2001@gmail.com";
|
||||||
|
# signing = {
|
||||||
|
# signByDefault = true;
|
||||||
|
# key = "675AA7EF13964ACB";
|
||||||
|
# };
|
||||||
|
# # init.defaultBranch = "master";
|
||||||
|
# lfs = {
|
||||||
|
# enable = true;
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
|
||||||
|
|
||||||
home.file.".gnupg/gpg-agent.conf" = {
|
home.file.".gnupg/gpg-agent.conf" = {
|
||||||
text = ''
|
text = ''
|
||||||
allow-preset-passphrase
|
allow-preset-passphrase
|
||||||
|
|
|
@ -23,14 +23,6 @@
|
||||||
inputs.zls-overlay.packages.x86_64-darwin.default
|
inputs.zls-overlay.packages.x86_64-darwin.default
|
||||||
];
|
];
|
||||||
|
|
||||||
nixpkgs = {
|
|
||||||
overlays = [
|
|
||||||
inputs.zig-overlay.overlays.default
|
|
||||||
];
|
|
||||||
|
|
||||||
config.allowUnfree = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
programs.git = {
|
programs.git = {
|
||||||
enable = true;
|
enable = true;
|
||||||
userName = "apavel";
|
userName = "apavel";
|
||||||
|
|
|
@ -7,14 +7,6 @@
|
||||||
stateVersion = "23.05";
|
stateVersion = "23.05";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Add custom overlays
|
|
||||||
nixpkgs = {
|
|
||||||
overlays = [
|
|
||||||
inputs.neovim-nightly-overlay.overlays.default
|
|
||||||
inputs.zig-overlay.overlays.default
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Set env vars
|
# Set env vars
|
||||||
home.sessionVariables = {
|
home.sessionVariables = {
|
||||||
EDITOR = "nvim";
|
EDITOR = "nvim";
|
||||||
|
|
|
@ -10,15 +10,6 @@
|
||||||
stateVersion = "23.05";
|
stateVersion = "23.05";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Add custom overlays
|
|
||||||
nixpkgs = {
|
|
||||||
overlays = [
|
|
||||||
inputs.neovim-nightly-overlay.overlays.default
|
|
||||||
inputs.zig-overlay.overlays.default
|
|
||||||
# inputs.zls-overlay.???
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Let Home Manager install and manage itself.
|
# Let Home Manager install and manage itself.
|
||||||
programs.home-manager.enable = true;
|
programs.home-manager.enable = true;
|
||||||
|
|
||||||
|
|
|
@ -94,12 +94,6 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nixpkgs = {
|
|
||||||
config = {
|
|
||||||
allowUnfree = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
### Fonts
|
### Fonts
|
||||||
fonts.fontconfig.enable = true;
|
fonts.fontconfig.enable = true;
|
||||||
|
|
||||||
|
|
|
@ -5,16 +5,6 @@
|
||||||
inputs.wired.homeManagerModules.default
|
inputs.wired.homeManagerModules.default
|
||||||
];
|
];
|
||||||
|
|
||||||
nixpkgs = {
|
|
||||||
overlays = builtins.attrValues outputs.overlays ++ [
|
|
||||||
inputs.neovim-nightly-overlay.overlays.default
|
|
||||||
inputs.zig-overlay.overlays.default
|
|
||||||
inputs.wired.overlays.default
|
|
||||||
];
|
|
||||||
|
|
||||||
config.allowUnfree = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
home = {
|
home = {
|
||||||
username = "reo101";
|
username = "reo101";
|
||||||
homeDirectory = "/home/reo101";
|
homeDirectory = "/home/reo101";
|
||||||
|
|
|
@ -22,15 +22,6 @@
|
||||||
# localStorageDir = "${inputs.self}/secrets/rekeyed/${config.networking.hostName}";
|
# localStorageDir = "${inputs.self}/secrets/rekeyed/${config.networking.hostName}";
|
||||||
};
|
};
|
||||||
|
|
||||||
nixpkgs = {
|
|
||||||
hostPlatform = "x86_64-linux";
|
|
||||||
config = {
|
|
||||||
allowUnfree = true;
|
|
||||||
};
|
|
||||||
overlays = [
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
networking.hostName = "jeeves";
|
networking.hostName = "jeeves";
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
|
|
|
@ -5,12 +5,6 @@
|
||||||
inputs.wired.homeManagerModules.default
|
inputs.wired.homeManagerModules.default
|
||||||
];
|
];
|
||||||
|
|
||||||
nixpkgs = {
|
|
||||||
overlays = builtins.attrValues outputs.overlays;
|
|
||||||
|
|
||||||
config.allowUnfree = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
home = {
|
home = {
|
||||||
username = "jeeves";
|
username = "jeeves";
|
||||||
homeDirectory = "/home/jeeves";
|
homeDirectory = "/home/jeeves";
|
||||||
|
|
|
@ -18,11 +18,13 @@
|
||||||
# inputs);
|
# inputs);
|
||||||
# };
|
# };
|
||||||
|
|
||||||
# Use flake overlays by default
|
# NOTE: now automatic, since we're doing `useGlobalPkgs = true`
|
||||||
nixpkgs = {
|
#
|
||||||
overlays = lib.attrValues outputs.overlays;
|
# # Use flake overlays by default
|
||||||
|
# nixpkgs = {
|
||||||
config.allowUnfree = true;
|
# overlays = lib.attrValues outputs.overlays;
|
||||||
};
|
#
|
||||||
|
# config.allowUnfree = true;
|
||||||
|
# };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
{ lib, config, self, inputs, ... }:
|
{ lib, config, self, inputs, withSystem, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (inputs)
|
|
||||||
nixpkgs;
|
|
||||||
# TODO: works?
|
# TODO: works?
|
||||||
outputs = self;
|
outputs = self;
|
||||||
inherit (import ./utils.nix { inherit lib self; })
|
inherit (import ./utils.nix { inherit lib self; })
|
||||||
|
@ -11,31 +9,45 @@ let
|
||||||
hasDirectories;
|
hasDirectories;
|
||||||
in
|
in
|
||||||
let
|
let
|
||||||
|
homeManagerModule = { root, system, hostname, users ? null }: {
|
||||||
|
home-manager = {
|
||||||
|
# Use same `pkgs` instance as system (i.e. carry over overlays)
|
||||||
|
useGlobalPkgs = true;
|
||||||
|
# Do not keep packages in ${HOME}
|
||||||
|
useUserPackages = true;
|
||||||
|
# Default import all of our exported homeManagerModules
|
||||||
|
sharedModules = builtins.attrValues config.flake.homeManagerModules;
|
||||||
|
# Pass in `inputs`, `outputs` and maybe `meta`
|
||||||
|
extraSpecialArgs = {
|
||||||
|
inherit inputs outputs;
|
||||||
|
# TODO: meta?
|
||||||
|
inherit hostname;
|
||||||
|
};
|
||||||
|
} // (if users == null then {
|
||||||
|
# nixOnDroid
|
||||||
|
config = (lib.path.append root "home.nix");
|
||||||
|
} else {
|
||||||
|
# Not nixOnDroid
|
||||||
|
users = lib.attrsets.genAttrs
|
||||||
|
users
|
||||||
|
(user: import (lib.path.append root "home/${user}.nix"));
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
# Configuration helpers
|
# Configuration helpers
|
||||||
mkNixosHost = root: system: hostname: users: lib.nixosSystem {
|
mkNixosHost = args @ { root, system, hostname, users }: lib.nixosSystem {
|
||||||
inherit system;
|
inherit system;
|
||||||
|
pkgs = withSystem system ({ pkgs, ... }: pkgs);
|
||||||
|
|
||||||
modules = [
|
modules = [
|
||||||
|
# Main configuration
|
||||||
(lib.path.append root "configuration.nix")
|
(lib.path.append root "configuration.nix")
|
||||||
|
# Home Manager
|
||||||
inputs.home-manager.nixosModules.home-manager
|
inputs.home-manager.nixosModules.home-manager
|
||||||
|
(homeManagerModule args)
|
||||||
|
# nix-topology
|
||||||
inputs.nix-topology.nixosModules.default
|
inputs.nix-topology.nixosModules.default
|
||||||
{
|
# Sane default `networking.hostName`
|
||||||
nixpkgs.overlays = builtins.attrValues self.overlays;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
home-manager = {
|
|
||||||
useGlobalPkgs = false;
|
|
||||||
useUserPackages = true;
|
|
||||||
users = lib.attrsets.genAttrs
|
|
||||||
users
|
|
||||||
(user: import (lib.path.append root "home/${user}.nix"));
|
|
||||||
sharedModules = builtins.attrValues config.flake.homeManagerModules;
|
|
||||||
extraSpecialArgs = {
|
|
||||||
inherit inputs outputs;
|
|
||||||
inherit hostname;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
networking.hostName = lib.mkDefault hostname;
|
networking.hostName = lib.mkDefault hostname;
|
||||||
}
|
}
|
||||||
|
@ -46,71 +58,39 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
mkNixOnDroidHost = root: system: hostname: inputs.nix-on-droid.lib.nixOnDroidConfiguration {
|
mkNixOnDroidHost = args @ { root, system, hostname }: inputs.nix-on-droid.lib.nixOnDroidConfiguration {
|
||||||
pkgs = import nixpkgs {
|
# NOTE: inferred by `pkgs.system`
|
||||||
inherit system;
|
# inherit system;
|
||||||
|
pkgs = withSystem system ({ pkgs, ... }: pkgs);
|
||||||
overlays = builtins.attrValues self.overlays ++ [
|
|
||||||
inputs.nix-on-droid.overlays.default
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
modules = [
|
modules = [
|
||||||
|
# Main configuration
|
||||||
(lib.path.append root "configuration.nix")
|
(lib.path.append root "configuration.nix")
|
||||||
{
|
# Home Manager
|
||||||
home-manager = {
|
(homeManagerModule args)
|
||||||
config = (lib.path.append root "home.nix");
|
|
||||||
backupFileExtension = "hm-bak";
|
|
||||||
useGlobalPkgs = false;
|
|
||||||
useUserPackages = true;
|
|
||||||
sharedModules = builtins.attrValues config.flake.homeManagerModules ++ [
|
|
||||||
{
|
|
||||||
nixpkgs.overlays = builtins.attrValues self.overlays;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
extraSpecialArgs = {
|
|
||||||
inherit inputs outputs;
|
|
||||||
inherit hostname;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
] ++ (builtins.attrValues config.flake.nixOnDroidModules);
|
] ++ (builtins.attrValues config.flake.nixOnDroidModules);
|
||||||
|
|
||||||
extraSpecialArgs = {
|
extraSpecialArgs = {
|
||||||
inherit inputs outputs;
|
inherit inputs outputs;
|
||||||
inherit hostname;
|
|
||||||
# rootPath = ./.;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
home-manager-path = inputs.home-manager.outPath;
|
home-manager-path = inputs.home-manager.outPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
mkNixDarwinHost = root: system: hostname: users: inputs.nix-darwin.lib.darwinSystem {
|
mkNixDarwinHost = args @ { root, system, hostname, users }: inputs.nix-darwin.lib.darwinSystem {
|
||||||
inherit system;
|
inherit system;
|
||||||
|
pkgs = withSystem system ({ pkgs, ... }: pkgs);
|
||||||
|
|
||||||
modules = [
|
modules = [
|
||||||
|
# Main configuration
|
||||||
(lib.path.append root "configuration.nix")
|
(lib.path.append root "configuration.nix")
|
||||||
{
|
# Home Manager
|
||||||
nixpkgs.hostPlatform = system;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
nixpkgs.overlays = builtins.attrValues self.overlays;
|
|
||||||
}
|
|
||||||
inputs.home-manager.darwinModules.home-manager
|
inputs.home-manager.darwinModules.home-manager
|
||||||
{
|
(homeManagerModule args)
|
||||||
home-manager = {
|
# # Set `nixpkgs.hostPlatform`
|
||||||
useGlobalPkgs = false;
|
# {
|
||||||
useUserPackages = true;
|
# nixpkgs.hostPlatform = system;
|
||||||
users = lib.attrsets.genAttrs
|
# }
|
||||||
users
|
|
||||||
(user: import (lib.path.append root "home/${user}.nix"));
|
|
||||||
sharedModules = builtins.attrValues config.flake.homeManagerModules;
|
|
||||||
extraSpecialArgs = {
|
|
||||||
inherit inputs outputs;
|
|
||||||
inherit hostname;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
] ++ (builtins.attrValues config.flake.nixDarwinModules);
|
] ++ (builtins.attrValues config.flake.nixDarwinModules);
|
||||||
|
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
|
@ -118,14 +98,12 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
mkHomeManagerHost = root: system: hostname: inputs.home-manager.lib.homeManagerConfiguration {
|
mkHomeManagerHost = args @ { root, system, hostname }: inputs.home-manager.lib.homeManagerConfiguration {
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
inherit system;
|
||||||
|
pkgs = withSystem system ({ pkgs, ... }: pkgs);
|
||||||
|
|
||||||
modules = [
|
modules = [
|
||||||
(lib.path.append root "home.nix")
|
(lib.path.append root "home.nix")
|
||||||
{
|
|
||||||
nixpkgs.overlays = builtins.attrValues self.overlays;
|
|
||||||
}
|
|
||||||
] ++ (builtins.attrValues config.flake.homeManagerModules);
|
] ++ (builtins.attrValues config.flake.homeManagerModules);
|
||||||
|
|
||||||
extraSpecialArgs = {
|
extraSpecialArgs = {
|
||||||
|
@ -154,7 +132,6 @@ let
|
||||||
})
|
})
|
||||||
hosts)
|
hosts)
|
||||||
machines));
|
machines));
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
flake = {
|
flake = {
|
||||||
|
@ -172,13 +149,14 @@ in
|
||||||
# config)
|
# config)
|
||||||
])
|
])
|
||||||
(system: host: configuration:
|
(system: host: configuration:
|
||||||
mkNixosHost
|
mkNixosHost {
|
||||||
../machines/nixos/${system}/${host}
|
root = ../machines/nixos/${system}/${host};
|
||||||
system
|
inherit system;
|
||||||
host
|
hostname = host;
|
||||||
(builtins.map
|
users = (builtins.map
|
||||||
(lib.strings.removeSuffix ".nix")
|
(lib.strings.removeSuffix ".nix")
|
||||||
(builtins.attrNames (configuration."home" or { }))))
|
(builtins.attrNames (configuration."home" or { })));
|
||||||
|
})
|
||||||
config.flake.nixosMachines;
|
config.flake.nixosMachines;
|
||||||
|
|
||||||
nixOnDroidConfigurations =
|
nixOnDroidConfigurations =
|
||||||
|
@ -191,10 +169,11 @@ in
|
||||||
configuration)
|
configuration)
|
||||||
])
|
])
|
||||||
(system: host: configuration:
|
(system: host: configuration:
|
||||||
mkNixOnDroidHost
|
mkNixOnDroidHost {
|
||||||
../machines/nix-on-droid/${system}/${host}
|
root = ../machines/nix-on-droid/${system}/${host};
|
||||||
system
|
inherit system;
|
||||||
host)
|
hostname = host;
|
||||||
|
})
|
||||||
config.flake.nixOnDroidMachines;
|
config.flake.nixOnDroidMachines;
|
||||||
|
|
||||||
darwinConfigurations =
|
darwinConfigurations =
|
||||||
|
@ -210,13 +189,14 @@ in
|
||||||
configuration)
|
configuration)
|
||||||
])
|
])
|
||||||
(system: host: configuration:
|
(system: host: configuration:
|
||||||
mkNixDarwinHost
|
mkNixDarwinHost {
|
||||||
../machines/nix-darwin/${system}/${host}
|
root = ../machines/nix-darwin/${system}/${host};
|
||||||
system
|
inherit system;
|
||||||
host
|
hostname = host;
|
||||||
(builtins.map
|
users = (builtins.map
|
||||||
(lib.strings.removeSuffix ".nix")
|
(lib.strings.removeSuffix ".nix")
|
||||||
(builtins.attrNames (configuration."home" or { }))))
|
(builtins.attrNames (configuration."home" or { })));
|
||||||
|
})
|
||||||
config.flake.nixDarwinMachines;
|
config.flake.nixDarwinMachines;
|
||||||
|
|
||||||
homeConfigurations =
|
homeConfigurations =
|
||||||
|
@ -229,10 +209,11 @@ in
|
||||||
configuration)
|
configuration)
|
||||||
])
|
])
|
||||||
(system: host: configuration:
|
(system: host: configuration:
|
||||||
mkHomeManagerHost
|
mkHomeManagerHost {
|
||||||
../machines/home-manager/${system}/${host}
|
root = ../machines/home-manager/${system}/${host};
|
||||||
system
|
inherit system;
|
||||||
host)
|
hostname = host;
|
||||||
|
})
|
||||||
config.flake.homeManagerMachines;
|
config.flake.homeManagerMachines;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
14
nix/pkgs.nix
14
nix/pkgs.nix
|
@ -1,13 +1,21 @@
|
||||||
{ lib, config, self, inputs, ... }:
|
{ inputs, self, lib, config, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
perSystem = { lib, pkgs, system, ... }: {
|
perSystem = { system, ... }: {
|
||||||
_module.args.pkgs = import inputs.nixpkgs {
|
_module.args.pkgs = import inputs.nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
overlays = lib.attrValues self.overlays ++ [
|
overlays = lib.attrValues self.overlays ++ [
|
||||||
|
inputs.neovim-nightly-overlay.overlays.default
|
||||||
|
inputs.zig-overlay.overlays.default
|
||||||
inputs.nix-topology.overlays.default
|
inputs.nix-topology.overlays.default
|
||||||
|
inputs.wired.overlays.default
|
||||||
|
# nix-on-droid overlay (needed for `proot`)
|
||||||
|
inputs.nix-on-droid.overlays.default
|
||||||
];
|
];
|
||||||
config = { };
|
config = {
|
||||||
|
# TODO: per machine?
|
||||||
|
allowUnfree = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# This file defines overlays
|
# This file defines overlays
|
||||||
{ inputs, outputs, ... }:
|
{ inputs, ... }:
|
||||||
{
|
{
|
||||||
# This one brings our custom packages from the 'pkgs' directory
|
# This one brings our custom packages from the 'pkgs' directory
|
||||||
additions = final: _prev: import ../pkgs {
|
additions = final: _prev: import ../pkgs {
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
# If pkgs is not defined, instanciate nixpkgs from locked commit
|
# If pkgs is not defined, instanciate nixpkgs from locked commit
|
||||||
{ pkgs ? (import ../nixpkgs.nix) { }
|
{ pkgs ? (import ../nixpkgs.nix) { }
|
||||||
, inputs
|
, inputs
|
||||||
, outputs
|
|
||||||
, ...
|
, ...
|
||||||
}: {
|
}: {
|
||||||
default = import ./default { inherit pkgs inputs outputs; };
|
default = import ./default { inherit pkgs inputs; };
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
# Shell for bootstrapping flake-enabled nix and other tooling
|
# Shell for bootstrapping flake-enabled nix and other tooling
|
||||||
{ pkgs
|
{ pkgs
|
||||||
, inputs
|
, inputs
|
||||||
, outputs
|
|
||||||
, ...
|
, ...
|
||||||
}: pkgs.mkShell {
|
}: pkgs.mkShellNoCC {
|
||||||
NIX_CONFIG = ''
|
NIX_CONFIG = ''
|
||||||
extra-experimental-features = nix-command flakes
|
extra-experimental-features = nix-command flakes
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
{ inputs, outputs, ... }:
|
{ inputs, ... }:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue