mirror of
https://github.com/kittywitch/nixfiles.git
synced 2026-02-09 12:29:19 -08:00
feat: flake-compat
This commit is contained in:
parent
ed581ca5b4
commit
419fcaa79f
5 changed files with 170 additions and 132 deletions
129
default.nix
129
default.nix
|
|
@ -1,122 +1,7 @@
|
||||||
{ self, utils, nixpkgs, darwin, home-manager, ragenix, scalpel, mach-nix, arcexprs, ... }@inputs: let
|
let
|
||||||
tree = (inputs.tree.tree {
|
inputs = import ./inputs.nix;
|
||||||
inherit inputs;
|
self = import ./outputs.nix ({
|
||||||
folder = ./.;
|
inherit self inputs;
|
||||||
config = {
|
system = builtins.currentSystem;
|
||||||
"/" = {
|
} // inputs);
|
||||||
excludes = [
|
in self
|
||||||
"flake"
|
|
||||||
"default"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
"nixos/modules" = {
|
|
||||||
functor = {
|
|
||||||
enable = true;
|
|
||||||
external = with (import (arcexprs + "/modules")).nixos; [
|
|
||||||
base16
|
|
||||||
base16-shared
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
"home/modules" = {
|
|
||||||
functor = {
|
|
||||||
enable = true;
|
|
||||||
external = with (import (arcexprs + "/modules")).home-manager; [
|
|
||||||
base16
|
|
||||||
base16-shared
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
"home".evaluateDefault = true;
|
|
||||||
"home/*" = {
|
|
||||||
functor.enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}).impure;
|
|
||||||
lib = inputs.nixpkgs.lib;
|
|
||||||
inherit (lib.attrsets) mapAttrs;
|
|
||||||
inherit (lib.lists) singleton;
|
|
||||||
in utils.lib.mkFlake {
|
|
||||||
inherit self inputs;
|
|
||||||
supportedSystems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
|
|
||||||
channelsConfig.allowUnfree = true;
|
|
||||||
|
|
||||||
hostDefaults = {
|
|
||||||
system = "x86_64-linux";
|
|
||||||
extraArgs = {
|
|
||||||
inherit inputs tree;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
hosts = let
|
|
||||||
outputForSystem = system: {
|
|
||||||
"x86_64-linux" = "nixosConfigurations";
|
|
||||||
"aarch64-darwin" = "darwinConfigurations";
|
|
||||||
}.${system};
|
|
||||||
builderForSystem = system: {
|
|
||||||
"x86_64-linux" = nixpkgs.lib.nixosSystem;
|
|
||||||
"aarch64-darwin" = darwin.lib.darwinSystem;
|
|
||||||
}.${system};
|
|
||||||
modulesForSystem = system: {
|
|
||||||
"x86_64-linux" = [
|
|
||||||
home-manager.nixosModules.home-manager
|
|
||||||
ragenix.nixosModules.age
|
|
||||||
tree.nixos.modules
|
|
||||||
];
|
|
||||||
"aarch64-darwin" = [
|
|
||||||
home-manager.darwinModules.home-manager
|
|
||||||
ragenix.nixosModules.age
|
|
||||||
tree.darwin.modules
|
|
||||||
];
|
|
||||||
}.${system};
|
|
||||||
mapSystem = system: name: path: {
|
|
||||||
inherit system;
|
|
||||||
output = outputForSystem system;
|
|
||||||
builder = builderForSystem system;
|
|
||||||
modules = (modulesForSystem system) ++ [
|
|
||||||
path
|
|
||||||
];
|
|
||||||
extraArgs = {
|
|
||||||
machine = name;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in mapAttrs (mapSystem "x86_64-linux") tree.nixos.systems
|
|
||||||
// mapAttrs (mapSystem "aarch64-darwin") tree.darwin.systems;
|
|
||||||
|
|
||||||
outputsBuilder = channels: {
|
|
||||||
nixosConfigurations = mapAttrs(_: sys: sys.extendModules {
|
|
||||||
modules = [ scalpel.nixosModule ];
|
|
||||||
specialArgs = {
|
|
||||||
prev = sys;
|
|
||||||
};
|
|
||||||
}) self.nixosConfigurations;
|
|
||||||
|
|
||||||
homeManagerConfigurations = mapAttrs (name: path: home-manager.lib.homeManagerConfiguration {
|
|
||||||
pkgs = channels.nixpkgs;
|
|
||||||
extraSpecialArgs = {
|
|
||||||
inherit inputs tree;
|
|
||||||
machine = name;
|
|
||||||
};
|
|
||||||
modules = [
|
|
||||||
({ config, ... }: {
|
|
||||||
home = {
|
|
||||||
username = "kat";
|
|
||||||
stateVersion = "22.11";
|
|
||||||
homeDirectory = "/home/kat";
|
|
||||||
};
|
|
||||||
})
|
|
||||||
path
|
|
||||||
];
|
|
||||||
}) tree.home;
|
|
||||||
|
|
||||||
inherit tree;
|
|
||||||
};
|
|
||||||
|
|
||||||
devShells = {
|
|
||||||
"python" = mach-nix.mkPythonShell {
|
|
||||||
python = "python310";
|
|
||||||
requirements = ''
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
|
||||||
35
flake.lock
generated
35
flake.lock
generated
|
|
@ -24,11 +24,11 @@
|
||||||
"arcexprs": {
|
"arcexprs": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1669933794,
|
"lastModified": 1670140114,
|
||||||
"narHash": "sha256-+7kYj0AhffjlrLXksTmCfcovRqDrBOF9TZA2jSlsfws=",
|
"narHash": "sha256-Z8lmLwKTf171WYH8EMko57VtobF8DgPtKL3ioXBlKP4=",
|
||||||
"owner": "arcnmx",
|
"owner": "arcnmx",
|
||||||
"repo": "nixexprs",
|
"repo": "nixexprs",
|
||||||
"rev": "1adfd2810dd37e78ee98e5cd18afe2e87d4bbe38",
|
"rev": "be538181c1937c11d4ad4a0b4da203169f150be2",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -74,6 +74,22 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"flake-compat": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1668681692,
|
||||||
|
"narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=",
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"rev": "009399224d5e398d03b22badca40a37ac85412a1",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1644229661,
|
"lastModified": 1644229661,
|
||||||
|
|
@ -97,11 +113,11 @@
|
||||||
"utils": "utils"
|
"utils": "utils"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1670058827,
|
"lastModified": 1670163996,
|
||||||
"narHash": "sha256-T+yyncPpZWeIkFrG/Cgj21iopULY3BZGWIhcT5ZmCgM=",
|
"narHash": "sha256-6vbu9Wmh1Ov0VgkWuLAazQ/crzohdZ8jnQp87pDsy7s=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "eb3598cf44aa10f2a16fe38488a102c0f474d766",
|
"rev": "90b0e5f440160f54cb4f1f08372e1be554e10873",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -137,11 +153,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1669969257,
|
"lastModified": 1670064435,
|
||||||
"narHash": "sha256-mOS13sK3v+kfgP+1Mh56ohiG8uVhLHAo7m/q9kqAehc=",
|
"narHash": "sha256-+ELoY30UN+Pl3Yn7RWRPabykwebsVK/kYE9JsIsUMxQ=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "b72b8b94cf0c012b0252a9100a636cad69696666",
|
"rev": "61a8a98e6d557e6dd7ed0cdb54c3a3e3bbc5e25c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -197,6 +213,7 @@
|
||||||
"arcexprs": "arcexprs",
|
"arcexprs": "arcexprs",
|
||||||
"darwin": "darwin",
|
"darwin": "darwin",
|
||||||
"empty": "empty",
|
"empty": "empty",
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
"mach-nix": "mach-nix",
|
"mach-nix": "mach-nix",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
{
|
{
|
||||||
description = "kat's personal system flakes";
|
description = "kat's personal system flakes";
|
||||||
inputs = {
|
inputs = {
|
||||||
|
flake-compat = {
|
||||||
|
url = "github:edolstra/flake-compat";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
empty.url = "github:input-output-hk/empty-flake";
|
empty.url = "github:input-output-hk/empty-flake";
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
home-manager = {
|
home-manager = {
|
||||||
|
|
@ -45,5 +49,5 @@
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
outputs = { ... }@inputs: import ./default.nix inputs;
|
outputs = { ... }@inputs: import ./outputs.nix inputs;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
inputs.nix
Normal file
10
inputs.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
let
|
||||||
|
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||||
|
flakeCompat = fetchTarball {
|
||||||
|
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
||||||
|
sha256 = lock.nodes.flake-compat.locked.narHash;
|
||||||
|
};
|
||||||
|
kittywitch = import flakeCompat {
|
||||||
|
src = ./.;
|
||||||
|
};
|
||||||
|
in kittywitch.defaultNix.inputs
|
||||||
122
outputs.nix
Normal file
122
outputs.nix
Normal file
|
|
@ -0,0 +1,122 @@
|
||||||
|
{ self, utils, nixpkgs, darwin, home-manager, ragenix, scalpel, mach-nix, arcexprs, ... }@inputs: let
|
||||||
|
tree = (inputs.tree.tree {
|
||||||
|
inherit inputs;
|
||||||
|
folder = ./.;
|
||||||
|
config = {
|
||||||
|
"/" = {
|
||||||
|
excludes = [
|
||||||
|
"flake"
|
||||||
|
"default"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
"nixos/modules" = {
|
||||||
|
functor = {
|
||||||
|
enable = true;
|
||||||
|
external = with (import (arcexprs + "/modules")).nixos; [
|
||||||
|
base16
|
||||||
|
base16-shared
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"home/modules" = {
|
||||||
|
functor = {
|
||||||
|
enable = true;
|
||||||
|
external = with (import (arcexprs + "/modules")).home-manager; [
|
||||||
|
base16
|
||||||
|
base16-shared
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"home".evaluateDefault = true;
|
||||||
|
"home/*" = {
|
||||||
|
functor.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}).impure;
|
||||||
|
lib = inputs.nixpkgs.lib;
|
||||||
|
inherit (lib.attrsets) mapAttrs;
|
||||||
|
inherit (lib.lists) singleton;
|
||||||
|
in utils.lib.mkFlake {
|
||||||
|
inherit self inputs;
|
||||||
|
supportedSystems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
|
||||||
|
channelsConfig.allowUnfree = true;
|
||||||
|
|
||||||
|
hostDefaults = {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
extraArgs = {
|
||||||
|
inherit inputs tree;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
hosts = let
|
||||||
|
outputForSystem = system: {
|
||||||
|
"x86_64-linux" = "nixosConfigurations";
|
||||||
|
"aarch64-darwin" = "darwinConfigurations";
|
||||||
|
}.${system};
|
||||||
|
builderForSystem = system: {
|
||||||
|
"x86_64-linux" = nixpkgs.lib.nixosSystem;
|
||||||
|
"aarch64-darwin" = darwin.lib.darwinSystem;
|
||||||
|
}.${system};
|
||||||
|
modulesForSystem = system: {
|
||||||
|
"x86_64-linux" = [
|
||||||
|
home-manager.nixosModules.home-manager
|
||||||
|
ragenix.nixosModules.age
|
||||||
|
tree.nixos.modules
|
||||||
|
];
|
||||||
|
"aarch64-darwin" = [
|
||||||
|
home-manager.darwinModules.home-manager
|
||||||
|
ragenix.nixosModules.age
|
||||||
|
tree.darwin.modules
|
||||||
|
];
|
||||||
|
}.${system};
|
||||||
|
mapSystem = system: name: path: {
|
||||||
|
inherit system;
|
||||||
|
output = outputForSystem system;
|
||||||
|
builder = builderForSystem system;
|
||||||
|
modules = (modulesForSystem system) ++ [
|
||||||
|
path
|
||||||
|
];
|
||||||
|
extraArgs = {
|
||||||
|
machine = name;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in mapAttrs (mapSystem "x86_64-linux") tree.nixos.systems
|
||||||
|
// mapAttrs (mapSystem "aarch64-darwin") tree.darwin.systems;
|
||||||
|
|
||||||
|
outputsBuilder = channels: {
|
||||||
|
nixosConfigurations = mapAttrs(_: sys: sys.extendModules {
|
||||||
|
modules = [ scalpel.nixosModule ];
|
||||||
|
specialArgs = {
|
||||||
|
prev = sys;
|
||||||
|
};
|
||||||
|
}) self.nixosConfigurations;
|
||||||
|
|
||||||
|
homeManagerConfigurations = mapAttrs (name: path: home-manager.lib.homeManagerConfiguration {
|
||||||
|
pkgs = channels.nixpkgs;
|
||||||
|
extraSpecialArgs = {
|
||||||
|
inherit inputs tree;
|
||||||
|
machine = name;
|
||||||
|
};
|
||||||
|
modules = [
|
||||||
|
({ config, ... }: {
|
||||||
|
home = {
|
||||||
|
username = "kat";
|
||||||
|
stateVersion = "22.11";
|
||||||
|
homeDirectory = "/home/kat";
|
||||||
|
};
|
||||||
|
})
|
||||||
|
path
|
||||||
|
];
|
||||||
|
}) tree.home;
|
||||||
|
|
||||||
|
inherit tree;
|
||||||
|
};
|
||||||
|
|
||||||
|
devShells = {
|
||||||
|
"python" = mach-nix.mkPythonShell {
|
||||||
|
python = "python310";
|
||||||
|
requirements = ''
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue