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"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1721071152,
|
||||
"narHash": "sha256-GoshD2O4dDNuGPPK4AiVCkM38j9/8OImYudY0zjFDcc=",
|
||||
"lastModified": 1721402988,
|
||||
"narHash": "sha256-O5j5y5gpssVF5FNsSF7joTyrlW//LpwyLk6yBWgQ0VE=",
|
||||
"owner": "oddlama",
|
||||
"repo": "agenix-rekey",
|
||||
"rev": "d63898728266e3a30f5367a0efbbfaedf9cf8041",
|
||||
"rev": "3f1c787e2092d9c13142ae7572cc1c52b68f1c4c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -175,11 +175,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1721266288,
|
||||
"narHash": "sha256-MsyTzXu9CJVcBr44ct8ILKF/Ro7VlF+tVZTylzAoXSs=",
|
||||
"lastModified": 1721417620,
|
||||
"narHash": "sha256-6q9b1h8fI3hXg2DG6/vrKWCeG8c5Wj2Kvv22RCgedzg=",
|
||||
"owner": "nix-community",
|
||||
"repo": "disko",
|
||||
"rev": "e8e8d9a3a9c1d0e654ccda7834bf0288a9d15c47",
|
||||
"rev": "bec6e3cde912b8acb915fecdc509eda7c973fb42",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -674,11 +674,11 @@
|
|||
},
|
||||
"hardware": {
|
||||
"locked": {
|
||||
"lastModified": 1721331912,
|
||||
"narHash": "sha256-h2yaU+QEU4pHxMySHPIsRV2T/pihDHnrXBca8BY6xgc=",
|
||||
"lastModified": 1721413321,
|
||||
"narHash": "sha256-0GdiQScDceUrVGbxYpV819LHesK3szHOhJ09e6sgES4=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixos-hardware",
|
||||
"rev": "bb90787ea034c8b9035dfcfc9b4dc23898d414be",
|
||||
"rev": "ab165a8a6cd12781d76fe9cbccb9e975d0fb634f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -823,11 +823,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1721281012,
|
||||
"narHash": "sha256-km+EYinh23cAztAFDi2dX/Dqx9NN9jjmyFAII1CZB4Y=",
|
||||
"lastModified": 1721368131,
|
||||
"narHash": "sha256-dvDYa+Z2qZHTibmeUbKKIpR2jONO4UPbyHiDgYhgoMQ=",
|
||||
"owner": "nix-community",
|
||||
"repo": "neovim-nightly-overlay",
|
||||
"rev": "bc1d14af6c0834c68b09fdfd588b4e82bd8177d1",
|
||||
"rev": "d9fcc47baa026c7df9a9789d5e825b4f13a9239a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -839,11 +839,11 @@
|
|||
"neovim-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1721260040,
|
||||
"narHash": "sha256-Aj1WC8RCOx000R97YPzocO3QGTaj0YVhGF1fDxWwqWo=",
|
||||
"lastModified": 1721316387,
|
||||
"narHash": "sha256-qPgppLqmnd0OnHLMo4cGPZSUyLbcw9nThWO4sJC8bWI=",
|
||||
"owner": "neovim",
|
||||
"repo": "neovim",
|
||||
"rev": "185b22720de9156393ddc22c2c59dc3eb46b8d97",
|
||||
"rev": "f61efe3fe77c9a517dccb9fd5ff7f16c0660ced4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -1119,11 +1119,11 @@
|
|||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1721138476,
|
||||
"narHash": "sha256-+W5eZOhhemLQxelojLxETfbFbc19NWawsXBlapYpqIA=",
|
||||
"lastModified": 1721379653,
|
||||
"narHash": "sha256-8MUgifkJ7lkZs3u99UDZMB4kbOxvMEXQZ31FO3SopZ0=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "ad0b5eed1b6031efaed382844806550c3dcb4206",
|
||||
"rev": "1d9c2c9b3e71b9ee663d11c5d298727dace8d374",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -1221,11 +1221,11 @@
|
|||
},
|
||||
"nur": {
|
||||
"locked": {
|
||||
"lastModified": 1721335575,
|
||||
"narHash": "sha256-dry8Y8MwACIdIBVFDOFQGpKd8PmEIPv9Ej0UdrdOlG8=",
|
||||
"lastModified": 1721472350,
|
||||
"narHash": "sha256-XFGmZB6GhnYsTOFouj60lc40OkZxpdk6mL2nTT0fIkU=",
|
||||
"owner": "nix-community",
|
||||
"repo": "NUR",
|
||||
"rev": "6e46867fdecc920a1de55dc1e553a16f54e2d2ee",
|
||||
"rev": "b4365ef44d92f9f6bd6ad3e54117d1719ebd2c57",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -1651,11 +1651,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1721304636,
|
||||
"narHash": "sha256-vpincauiWXBtlQLzGQNjAGlOjfOuh+nb30AUAsnMhWs=",
|
||||
"lastModified": 1721390978,
|
||||
"narHash": "sha256-he5AUpgwVAT/VXtkUOiMsz5cYblXw2qAGs1wADW9ji8=",
|
||||
"owner": "mitchellh",
|
||||
"repo": "zig-overlay",
|
||||
"rev": "a88326d1947156a6ad22b00d44fb3f1bf0a98673",
|
||||
"rev": "c7615d701b2a5355a3f3013918b6b945c394e791",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -1677,11 +1677,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1721153775,
|
||||
"narHash": "sha256-kReih1LP5I9J0P+ByAOKNv/d4re0P/bH2AD6InGjN1U=",
|
||||
"lastModified": 1721428418,
|
||||
"narHash": "sha256-4CLofMcvvunlfZ0irCjEWCzetMMwuBUaski2qwNtsjk=",
|
||||
"owner": "zigtools",
|
||||
"repo": "zls",
|
||||
"rev": "41dae221fab979b3764e9191d8126e09625b0bb2",
|
||||
"rev": "b9e17146ba64d683fed0cb07156ec6052207f4d4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -164,7 +164,7 @@
|
|||
apps = import ./apps { inherit pkgs; };
|
||||
|
||||
# Dev Shells (`nix develop`)
|
||||
devShells = import ./shells { inherit pkgs inputs outputs; };
|
||||
devShells = import ./shells { inherit pkgs inputs; };
|
||||
|
||||
# Formatter (`nix fmt`)
|
||||
formatter = pkgs.nixpkgs-fmt;
|
||||
|
@ -175,12 +175,12 @@
|
|||
|
||||
# Templates
|
||||
templates = import ./templates {
|
||||
inherit inputs outputs;
|
||||
inherit inputs;
|
||||
};
|
||||
|
||||
# Overlays
|
||||
overlays = import ./overlays {
|
||||
inherit inputs outputs;
|
||||
inherit inputs;
|
||||
};
|
||||
};
|
||||
});
|
||||
|
|
|
@ -14,32 +14,6 @@
|
|||
./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
|
||||
home = {
|
||||
username = "your-username";
|
||||
|
|
|
@ -8,10 +8,21 @@
|
|||
# Auto upgrade nix package and the daemon service.
|
||||
services.nix-daemon.enable = true;
|
||||
|
||||
nix = {
|
||||
nix = let
|
||||
flakeInputs = lib.filterAttrs (lib.const (lib.isType "flake")) inputs;
|
||||
in {
|
||||
# Ensure we can work with flakes
|
||||
# NOTE: run `sudo -i nix-env --uninstall nix` to uninstall the global `nix`
|
||||
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 = ''
|
||||
# # Enable flakes and new 'nix' command
|
||||
# experimental-features = nix-command flakes
|
||||
|
@ -24,15 +35,6 @@
|
|||
# keep-derivations = true
|
||||
# '';
|
||||
|
||||
# registry.nixpkgs.flake = inputs.nixpkgs;
|
||||
# registry =
|
||||
# lib.mapAttrs'
|
||||
# (name: value:
|
||||
# {
|
||||
# name = name;
|
||||
# value = { flake = value; };
|
||||
# })
|
||||
# inputs;
|
||||
|
||||
settings = {
|
||||
# Enable flakes and new 'nix' command
|
||||
|
@ -89,8 +91,7 @@
|
|||
programs.zsh.enable = true; # default shell on catalina
|
||||
|
||||
# Fonts
|
||||
fonts.fontDir.enable = true;
|
||||
fonts.fonts = with pkgs; [
|
||||
fonts.packages = with pkgs; [
|
||||
(nerdfonts.override { fonts = [ "FiraCode" ]; })
|
||||
];
|
||||
|
||||
|
|
|
@ -7,14 +7,6 @@
|
|||
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
|
||||
home.sessionVariables = {
|
||||
EDITOR = "nvim";
|
||||
|
@ -40,18 +32,33 @@
|
|||
|
||||
# Neovim
|
||||
neovim
|
||||
# (neovim.overrideAttrs (oldAttrs: {
|
||||
# lua = luajitcoroutineclone;
|
||||
# }))
|
||||
(pkgs.writeShellScriptBin "lua" "exec -a $0 ${luajitPackages.nlua}/bin/nlua $@")
|
||||
# luajitPackages.nlua
|
||||
fennel
|
||||
fennel-language-server
|
||||
# fennel-language-server
|
||||
fennel-ls
|
||||
git
|
||||
gh
|
||||
|
||||
# (gnumake.override { guileSupport = true; })
|
||||
gnumake
|
||||
|
||||
# # Emacs
|
||||
# (emacs-unstable.override {
|
||||
# withGTK3 = true;
|
||||
# :
|
||||
# })
|
||||
|
||||
# Dhall
|
||||
dhall
|
||||
# dhall
|
||||
# dhall-lsp-server
|
||||
|
||||
# Circom
|
||||
circom
|
||||
circom-lsp
|
||||
# circom
|
||||
# circom-lsp
|
||||
|
||||
# Nix
|
||||
nil
|
||||
|
@ -61,6 +68,9 @@
|
|||
# Mail
|
||||
# himalaya
|
||||
|
||||
# Java
|
||||
graalvm-ce
|
||||
|
||||
# SSH and GPG
|
||||
openssh
|
||||
gnupg
|
||||
|
@ -99,7 +109,26 @@
|
|||
wezterm = {
|
||||
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" = {
|
||||
text = ''
|
||||
|
|
|
@ -23,14 +23,6 @@
|
|||
inputs.zls-overlay.packages.x86_64-darwin.default
|
||||
];
|
||||
|
||||
nixpkgs = {
|
||||
overlays = [
|
||||
inputs.zig-overlay.overlays.default
|
||||
];
|
||||
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userName = "apavel";
|
||||
|
|
|
@ -7,14 +7,6 @@
|
|||
stateVersion = "23.05";
|
||||
};
|
||||
|
||||
# Add custom overlays
|
||||
nixpkgs = {
|
||||
overlays = [
|
||||
inputs.neovim-nightly-overlay.overlays.default
|
||||
inputs.zig-overlay.overlays.default
|
||||
];
|
||||
};
|
||||
|
||||
# Set env vars
|
||||
home.sessionVariables = {
|
||||
EDITOR = "nvim";
|
||||
|
|
|
@ -10,15 +10,6 @@
|
|||
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.
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
|
|
|
@ -94,12 +94,6 @@
|
|||
};
|
||||
};
|
||||
|
||||
nixpkgs = {
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
};
|
||||
};
|
||||
|
||||
### Fonts
|
||||
fonts.fontconfig.enable = true;
|
||||
|
||||
|
|
|
@ -5,16 +5,6 @@
|
|||
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 = {
|
||||
username = "reo101";
|
||||
homeDirectory = "/home/reo101";
|
||||
|
|
|
@ -22,15 +22,6 @@
|
|||
# localStorageDir = "${inputs.self}/secrets/rekeyed/${config.networking.hostName}";
|
||||
};
|
||||
|
||||
nixpkgs = {
|
||||
hostPlatform = "x86_64-linux";
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
};
|
||||
overlays = [
|
||||
];
|
||||
};
|
||||
|
||||
networking.hostName = "jeeves";
|
||||
|
||||
boot = {
|
||||
|
|
|
@ -5,12 +5,6 @@
|
|||
inputs.wired.homeManagerModules.default
|
||||
];
|
||||
|
||||
nixpkgs = {
|
||||
overlays = builtins.attrValues outputs.overlays;
|
||||
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
|
||||
home = {
|
||||
username = "jeeves";
|
||||
homeDirectory = "/home/jeeves";
|
||||
|
|
|
@ -18,11 +18,13 @@
|
|||
# inputs);
|
||||
# };
|
||||
|
||||
# Use flake overlays by default
|
||||
nixpkgs = {
|
||||
overlays = lib.attrValues outputs.overlays;
|
||||
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
# NOTE: now automatic, since we're doing `useGlobalPkgs = true`
|
||||
#
|
||||
# # Use flake overlays by default
|
||||
# nixpkgs = {
|
||||
# overlays = lib.attrValues outputs.overlays;
|
||||
#
|
||||
# config.allowUnfree = true;
|
||||
# };
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
{ lib, config, self, inputs, ... }:
|
||||
{ lib, config, self, inputs, withSystem, ... }:
|
||||
|
||||
let
|
||||
inherit (inputs)
|
||||
nixpkgs;
|
||||
# TODO: works?
|
||||
outputs = self;
|
||||
inherit (import ./utils.nix { inherit lib self; })
|
||||
|
@ -11,31 +9,45 @@ let
|
|||
hasDirectories;
|
||||
in
|
||||
let
|
||||
# Configuration helpers
|
||||
mkNixosHost = root: system: hostname: users: lib.nixosSystem {
|
||||
inherit system;
|
||||
|
||||
modules = [
|
||||
(lib.path.append root "configuration.nix")
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
inputs.nix-topology.nixosModules.default
|
||||
{
|
||||
nixpkgs.overlays = builtins.attrValues self.overlays;
|
||||
}
|
||||
{
|
||||
homeManagerModule = { root, system, hostname, users ? null }: {
|
||||
home-manager = {
|
||||
useGlobalPkgs = false;
|
||||
# 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"));
|
||||
sharedModules = builtins.attrValues config.flake.homeManagerModules;
|
||||
extraSpecialArgs = {
|
||||
inherit inputs outputs;
|
||||
inherit hostname;
|
||||
});
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
# Configuration helpers
|
||||
mkNixosHost = args @ { root, system, hostname, users }: lib.nixosSystem {
|
||||
inherit system;
|
||||
pkgs = withSystem system ({ pkgs, ... }: pkgs);
|
||||
|
||||
modules = [
|
||||
# Main configuration
|
||||
(lib.path.append root "configuration.nix")
|
||||
# Home Manager
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
(homeManagerModule args)
|
||||
# nix-topology
|
||||
inputs.nix-topology.nixosModules.default
|
||||
# Sane default `networking.hostName`
|
||||
{
|
||||
networking.hostName = lib.mkDefault hostname;
|
||||
}
|
||||
|
@ -46,71 +58,39 @@ let
|
|||
};
|
||||
};
|
||||
|
||||
mkNixOnDroidHost = root: system: hostname: inputs.nix-on-droid.lib.nixOnDroidConfiguration {
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
|
||||
overlays = builtins.attrValues self.overlays ++ [
|
||||
inputs.nix-on-droid.overlays.default
|
||||
];
|
||||
};
|
||||
mkNixOnDroidHost = args @ { root, system, hostname }: inputs.nix-on-droid.lib.nixOnDroidConfiguration {
|
||||
# NOTE: inferred by `pkgs.system`
|
||||
# inherit system;
|
||||
pkgs = withSystem system ({ pkgs, ... }: pkgs);
|
||||
|
||||
modules = [
|
||||
# Main configuration
|
||||
(lib.path.append root "configuration.nix")
|
||||
{
|
||||
home-manager = {
|
||||
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;
|
||||
};
|
||||
};
|
||||
}
|
||||
# Home Manager
|
||||
(homeManagerModule args)
|
||||
] ++ (builtins.attrValues config.flake.nixOnDroidModules);
|
||||
|
||||
extraSpecialArgs = {
|
||||
inherit inputs outputs;
|
||||
inherit hostname;
|
||||
# rootPath = ./.;
|
||||
};
|
||||
|
||||
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;
|
||||
pkgs = withSystem system ({ pkgs, ... }: pkgs);
|
||||
|
||||
modules = [
|
||||
# Main configuration
|
||||
(lib.path.append root "configuration.nix")
|
||||
{
|
||||
nixpkgs.hostPlatform = system;
|
||||
}
|
||||
{
|
||||
nixpkgs.overlays = builtins.attrValues self.overlays;
|
||||
}
|
||||
# Home Manager
|
||||
inputs.home-manager.darwinModules.home-manager
|
||||
{
|
||||
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;
|
||||
};
|
||||
};
|
||||
}
|
||||
(homeManagerModule args)
|
||||
# # Set `nixpkgs.hostPlatform`
|
||||
# {
|
||||
# nixpkgs.hostPlatform = system;
|
||||
# }
|
||||
] ++ (builtins.attrValues config.flake.nixDarwinModules);
|
||||
|
||||
specialArgs = {
|
||||
|
@ -118,14 +98,12 @@ let
|
|||
};
|
||||
};
|
||||
|
||||
mkHomeManagerHost = root: system: hostname: inputs.home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
mkHomeManagerHost = args @ { root, system, hostname }: inputs.home-manager.lib.homeManagerConfiguration {
|
||||
inherit system;
|
||||
pkgs = withSystem system ({ pkgs, ... }: pkgs);
|
||||
|
||||
modules = [
|
||||
(lib.path.append root "home.nix")
|
||||
{
|
||||
nixpkgs.overlays = builtins.attrValues self.overlays;
|
||||
}
|
||||
] ++ (builtins.attrValues config.flake.homeManagerModules);
|
||||
|
||||
extraSpecialArgs = {
|
||||
|
@ -154,7 +132,6 @@ let
|
|||
})
|
||||
hosts)
|
||||
machines));
|
||||
|
||||
in
|
||||
{
|
||||
flake = {
|
||||
|
@ -172,13 +149,14 @@ in
|
|||
# config)
|
||||
])
|
||||
(system: host: configuration:
|
||||
mkNixosHost
|
||||
../machines/nixos/${system}/${host}
|
||||
system
|
||||
host
|
||||
(builtins.map
|
||||
mkNixosHost {
|
||||
root = ../machines/nixos/${system}/${host};
|
||||
inherit system;
|
||||
hostname = host;
|
||||
users = (builtins.map
|
||||
(lib.strings.removeSuffix ".nix")
|
||||
(builtins.attrNames (configuration."home" or { }))))
|
||||
(builtins.attrNames (configuration."home" or { })));
|
||||
})
|
||||
config.flake.nixosMachines;
|
||||
|
||||
nixOnDroidConfigurations =
|
||||
|
@ -191,10 +169,11 @@ in
|
|||
configuration)
|
||||
])
|
||||
(system: host: configuration:
|
||||
mkNixOnDroidHost
|
||||
../machines/nix-on-droid/${system}/${host}
|
||||
system
|
||||
host)
|
||||
mkNixOnDroidHost {
|
||||
root = ../machines/nix-on-droid/${system}/${host};
|
||||
inherit system;
|
||||
hostname = host;
|
||||
})
|
||||
config.flake.nixOnDroidMachines;
|
||||
|
||||
darwinConfigurations =
|
||||
|
@ -210,13 +189,14 @@ in
|
|||
configuration)
|
||||
])
|
||||
(system: host: configuration:
|
||||
mkNixDarwinHost
|
||||
../machines/nix-darwin/${system}/${host}
|
||||
system
|
||||
host
|
||||
(builtins.map
|
||||
mkNixDarwinHost {
|
||||
root = ../machines/nix-darwin/${system}/${host};
|
||||
inherit system;
|
||||
hostname = host;
|
||||
users = (builtins.map
|
||||
(lib.strings.removeSuffix ".nix")
|
||||
(builtins.attrNames (configuration."home" or { }))))
|
||||
(builtins.attrNames (configuration."home" or { })));
|
||||
})
|
||||
config.flake.nixDarwinMachines;
|
||||
|
||||
homeConfigurations =
|
||||
|
@ -229,10 +209,11 @@ in
|
|||
configuration)
|
||||
])
|
||||
(system: host: configuration:
|
||||
mkHomeManagerHost
|
||||
../machines/home-manager/${system}/${host}
|
||||
system
|
||||
host)
|
||||
mkHomeManagerHost {
|
||||
root = ../machines/home-manager/${system}/${host};
|
||||
inherit system;
|
||||
hostname = host;
|
||||
})
|
||||
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 {
|
||||
inherit system;
|
||||
overlays = lib.attrValues self.overlays ++ [
|
||||
inputs.neovim-nightly-overlay.overlays.default
|
||||
inputs.zig-overlay.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
|
||||
{ inputs, outputs, ... }:
|
||||
{ inputs, ... }:
|
||||
{
|
||||
# This one brings our custom packages from the 'pkgs' directory
|
||||
additions = final: _prev: import ../pkgs {
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
# If pkgs is not defined, instanciate nixpkgs from locked commit
|
||||
{ pkgs ? (import ../nixpkgs.nix) { }
|
||||
, 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
|
||||
{ pkgs
|
||||
, inputs
|
||||
, outputs
|
||||
, ...
|
||||
}: pkgs.mkShell {
|
||||
}: pkgs.mkShellNoCC {
|
||||
NIX_CONFIG = ''
|
||||
extra-experimental-features = nix-command flakes
|
||||
'';
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
{ inputs, outputs, ... }:
|
||||
{ inputs, ... }:
|
||||
{
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue