mirror of
https://github.com/callumio/nixfiles.git
synced 2026-08-06 20:49:17 +01:00
tree imports all now
This commit is contained in:
parent
e692e1ec13
commit
9b48220a2a
11 changed files with 258 additions and 25 deletions
16
flake.lock
generated
16
flake.lock
generated
|
|
@ -604,6 +604,21 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"import-tree": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1773693634,
|
||||||
|
"narHash": "sha256-BtZ2dtkBdSUnFPPFc+n0kcMbgaTxzFNPv2iaO326Ffg=",
|
||||||
|
"owner": "vic",
|
||||||
|
"repo": "import-tree",
|
||||||
|
"rev": "c41e7d58045f9057880b0d85e1152d6a4430dbf1",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "vic",
|
||||||
|
"repo": "import-tree",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"inspect": {
|
"inspect": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
|
@ -1070,6 +1085,7 @@
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": "flake-compat",
|
||||||
"flake-parts": "flake-parts",
|
"flake-parts": "flake-parts",
|
||||||
"home-manager": "home-manager_2",
|
"home-manager": "home-manager_2",
|
||||||
|
"import-tree": "import-tree",
|
||||||
"nish": "nish",
|
"nish": "nish",
|
||||||
"nixinate": "nixinate",
|
"nixinate": "nixinate",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
|
|
|
||||||
41
flake.nix
41
flake.nix
|
|
@ -21,6 +21,14 @@
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
nixpkgs.overlays = [self.overlays.default] ++ ovl;
|
nixpkgs.overlays = [self.overlays.default] ++ ovl;
|
||||||
}
|
}
|
||||||
|
self.nixosModules.nix-config
|
||||||
|
self.nixosModules.boot
|
||||||
|
self.nixosModules.gpg-pinentry-wayland
|
||||||
|
self.nixosModules.keys
|
||||||
|
self.nixosModules.hm
|
||||||
|
self.nixosModules.secrets
|
||||||
|
self.nixosModules.tailscale
|
||||||
|
self.nixosModules.deploy
|
||||||
]
|
]
|
||||||
++ mod
|
++ mod
|
||||||
++ mods.sharedModules;
|
++ mods.sharedModules;
|
||||||
|
|
@ -31,6 +39,7 @@
|
||||||
inputs.flake-parts.flakeModules.easyOverlay
|
inputs.flake-parts.flakeModules.easyOverlay
|
||||||
inputs.pre-commit-hooks.flakeModule
|
inputs.pre-commit-hooks.flakeModule
|
||||||
inputs.treefmt-nix.flakeModule
|
inputs.treefmt-nix.flakeModule
|
||||||
|
(inputs.import-tree ./tree)
|
||||||
];
|
];
|
||||||
|
|
||||||
systems = import inputs.systems;
|
systems = import inputs.systems;
|
||||||
|
|
@ -40,10 +49,15 @@
|
||||||
# TODO: use ./hosts/
|
# TODO: use ./hosts/
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
artemis = mkLinuxSystem [./hosts/artemis] [];
|
artemis = mkLinuxSystem [./hosts/artemis] [];
|
||||||
hermes = mkLinuxSystem [./hosts/hermes inputs.nocodb.nixosModules.nocodb inputs.copyparty.nixosModules.default] [inputs.copyparty.overlays.default];
|
hermes =
|
||||||
|
mkLinuxSystem
|
||||||
|
[./hosts/hermes inputs.nocodb.nixosModules.nocodb inputs.copyparty.nixosModules.default]
|
||||||
|
[inputs.copyparty.overlays.default];
|
||||||
};
|
};
|
||||||
diskoConfigurations = {}; # maybe?
|
diskoConfigurations = {}; # maybe?
|
||||||
om.health.default = {nix-version.min-required = "2.18.5";};
|
om.health.default = {
|
||||||
|
nix-version.min-required = "2.18.5";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
perSystem = {
|
perSystem = {
|
||||||
|
|
@ -75,11 +89,26 @@
|
||||||
|
|
||||||
devShells.default = final.mkShell {
|
devShells.default = final.mkShell {
|
||||||
meta.description = "Default dev shell";
|
meta.description = "Default dev shell";
|
||||||
inputsFrom = [config.pre-commit.devShell config.treefmt.build.devShell];
|
inputsFrom = [
|
||||||
packages = with final; [just git nvf cachix jq devour-flake om agenix deadnix];
|
config.pre-commit.devShell
|
||||||
|
config.treefmt.build.devShell
|
||||||
|
];
|
||||||
|
packages = with final; [
|
||||||
|
just
|
||||||
|
git
|
||||||
|
nvf
|
||||||
|
cachix
|
||||||
|
jq
|
||||||
|
devour-flake
|
||||||
|
om
|
||||||
|
agenix
|
||||||
|
deadnix
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
apps = nixpkgs.lib.mapAttrs' (name: value: nixpkgs.lib.nameValuePair ("deploy-" + name) value) (inputs'.nixinate.packages self);
|
apps = nixpkgs.lib.mapAttrs' (name: value: nixpkgs.lib.nameValuePair ("deploy-" + name) value) (
|
||||||
|
inputs'.nixinate.packages self
|
||||||
|
);
|
||||||
|
|
||||||
packages = import ./packages {inherit pkgs inputs inputs';};
|
packages = import ./packages {inherit pkgs inputs inputs';};
|
||||||
};
|
};
|
||||||
|
|
@ -190,5 +219,7 @@
|
||||||
url = "github:nocodb/nocodb?ref=bec1fa4";
|
url = "github:nocodb/nocodb?ref=bec1fa4";
|
||||||
#inputs.nixpkgs.follows = "unstable";
|
#inputs.nixpkgs.follows = "unstable";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
import-tree.url = "github:vic/import-tree";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
let
|
let
|
||||||
exportModules = args:
|
exportModules = args:
|
||||||
builtins.listToAttrs (map (arg: {
|
builtins.listToAttrs (
|
||||||
|
map (arg: {
|
||||||
name = let
|
name = let
|
||||||
str = baseNameOf arg;
|
str = baseNameOf arg;
|
||||||
suffix = ".nix";
|
suffix = ".nix";
|
||||||
|
|
@ -13,30 +14,16 @@ let
|
||||||
|
|
||||||
value = import arg;
|
value = import arg;
|
||||||
})
|
})
|
||||||
args);
|
args
|
||||||
|
);
|
||||||
|
|
||||||
nixosModules = exportModules [
|
nixosModules =
|
||||||
./nix.nix
|
exportModules [
|
||||||
./pinentry-fix.nix
|
|
||||||
./hm.nix
|
|
||||||
./boot.nix
|
|
||||||
./keys.nix
|
|
||||||
./deploy.nix
|
|
||||||
./tailscale.nix
|
|
||||||
./secret.nix
|
|
||||||
];
|
];
|
||||||
homeManagerModules =
|
homeManagerModules =
|
||||||
exportModules [
|
exportModules [
|
||||||
];
|
];
|
||||||
sharedModules = with nixosModules; [
|
sharedModules = with nixosModules; [
|
||||||
pinentry-fix
|
|
||||||
nix
|
|
||||||
hm
|
|
||||||
boot
|
|
||||||
keys
|
|
||||||
deploy
|
|
||||||
tailscale
|
|
||||||
secret
|
|
||||||
];
|
];
|
||||||
in {
|
in {
|
||||||
inherit nixosModules homeManagerModules sharedModules;
|
inherit nixosModules homeManagerModules sharedModules;
|
||||||
|
|
|
||||||
23
tree/boot.nix
Normal file
23
tree/boot.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
{...}: {
|
||||||
|
flake.nixosModules.boot = {
|
||||||
|
boot = {
|
||||||
|
loader = {
|
||||||
|
efi.canTouchEfiVariables = true;
|
||||||
|
systemd-boot.enable = true;
|
||||||
|
};
|
||||||
|
plymouth.enable = false;
|
||||||
|
# consoleLogLevel = 0;
|
||||||
|
# initrd.verbose = false;
|
||||||
|
# kernelParams = [
|
||||||
|
# "quiet"
|
||||||
|
# "splash"
|
||||||
|
# "boot.shell_on_fail"
|
||||||
|
# "loglevel=3"
|
||||||
|
# "rd.systemd.show_status=false"
|
||||||
|
# "rd.udev.log_level=3"
|
||||||
|
# "udev.log_priority=3"
|
||||||
|
# ];
|
||||||
|
};
|
||||||
|
system.stateVersion = "24.05";
|
||||||
|
};
|
||||||
|
}
|
||||||
84
tree/deploy.nix
Normal file
84
tree/deploy.nix
Normal file
|
|
@ -0,0 +1,84 @@
|
||||||
|
{...}: {
|
||||||
|
flake.nixosModules.deploy = {
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.c.services.remote-deploy;
|
||||||
|
in {
|
||||||
|
options.c.services.remote-deploy = {
|
||||||
|
enable = mkEnableOption "Enable remote deployment with nixinate.";
|
||||||
|
host = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "Hostname to connect to.";
|
||||||
|
};
|
||||||
|
user = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "deploy";
|
||||||
|
description = "Username for deploy account.";
|
||||||
|
};
|
||||||
|
group = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "deploy";
|
||||||
|
description = "Group for deploy account.";
|
||||||
|
};
|
||||||
|
keys = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
description = "Authorised SSH keys for deployment";
|
||||||
|
};
|
||||||
|
port = mkOption {
|
||||||
|
type = types.port;
|
||||||
|
default = 22;
|
||||||
|
description = "SSH port to use.";
|
||||||
|
};
|
||||||
|
buildOn = mkOption {
|
||||||
|
type = types.enum [
|
||||||
|
"local"
|
||||||
|
"remote"
|
||||||
|
];
|
||||||
|
default = "local";
|
||||||
|
description = "Where to build the config.";
|
||||||
|
};
|
||||||
|
substituteOnTarget = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = "Substitute closures and paths from remote";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
_module.args = {
|
||||||
|
nixinate = {
|
||||||
|
inherit
|
||||||
|
(cfg)
|
||||||
|
host
|
||||||
|
buildOn
|
||||||
|
port
|
||||||
|
substituteOnTarget
|
||||||
|
;
|
||||||
|
sshUser = cfg.user;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
users.groups."${cfg.group}" = {};
|
||||||
|
users.users."${cfg.user}" = {
|
||||||
|
isSystemUser = true;
|
||||||
|
shell = pkgs.bash;
|
||||||
|
inherit (cfg) group;
|
||||||
|
openssh.authorizedKeys.keys = cfg.keys;
|
||||||
|
};
|
||||||
|
nix.settings.trusted-users = [cfg.user];
|
||||||
|
security.sudo.extraRules = [
|
||||||
|
{
|
||||||
|
groups = [cfg.group];
|
||||||
|
commands = [
|
||||||
|
{
|
||||||
|
command = "ALL";
|
||||||
|
options = ["NOPASSWD"];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
5
tree/gpg-pinentry-wayland.nix
Normal file
5
tree/gpg-pinentry-wayland.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{...}: {
|
||||||
|
flake.nixosModules.gpg-pinentry-wayland = {pkgs, ...}: {
|
||||||
|
services.dbus.packages = [pkgs.gcr];
|
||||||
|
};
|
||||||
|
}
|
||||||
6
tree/hm.nix
Normal file
6
tree/hm.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{...}: {
|
||||||
|
flake.nixosModules.hm = {...}: {
|
||||||
|
home-manager.useGlobalPkgs = true;
|
||||||
|
home-manager.useUserPackages = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
7
tree/keys.nix
Normal file
7
tree/keys.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
{...}: {
|
||||||
|
flake.nixosModules.keys = {lib, ...}: {
|
||||||
|
options.keys = lib.mkOption {
|
||||||
|
default = import ../lib/keys.nix;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
31
tree/nix.nix
Normal file
31
tree/nix.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
{inputs, ...}: {
|
||||||
|
flake.nixosModules.nix-config = {
|
||||||
|
nix = {
|
||||||
|
registry.nixpkgs.flake = inputs.nixpkgs;
|
||||||
|
registry.unstable.flake = inputs.unstable;
|
||||||
|
gc = {
|
||||||
|
automatic = true;
|
||||||
|
dates = "weekly";
|
||||||
|
options = "--delete-older-than 7d";
|
||||||
|
};
|
||||||
|
extraOptions = "gc-keep-outputs = true";
|
||||||
|
settings = {
|
||||||
|
experimental-features = [
|
||||||
|
"nix-command"
|
||||||
|
"flakes"
|
||||||
|
"auto-allocate-uids"
|
||||||
|
];
|
||||||
|
auto-optimise-store = true;
|
||||||
|
auto-allocate-uids = true;
|
||||||
|
substituters = [
|
||||||
|
"https://nix-community.cachix.org"
|
||||||
|
"https://callumio-public.cachix.org"
|
||||||
|
];
|
||||||
|
trusted-public-keys = [
|
||||||
|
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||||
|
"callumio-public.cachix.org-1:VucOSl7vh44GdqcILwMIeHlI0ufuAnHAl8cO1U/7yhg="
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
5
tree/secrets.nix
Normal file
5
tree/secrets.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{...}: {
|
||||||
|
flake.nixosModules.secrets = {...}: {
|
||||||
|
imports = [../secrets/secrets-configuration.nix];
|
||||||
|
};
|
||||||
|
}
|
||||||
38
tree/tailscale.nix
Normal file
38
tree/tailscale.nix
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
{...}: {
|
||||||
|
flake.nixosModules.tailscale = {
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.c.services.mesh;
|
||||||
|
in {
|
||||||
|
options.c.services.mesh = {
|
||||||
|
enable = mkEnableOption "Enable tailscale daemon.";
|
||||||
|
exitNode = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Enable advertising as an exit node.";
|
||||||
|
};
|
||||||
|
keyFile = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
description = "Path to key file.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
services.tailscale = {
|
||||||
|
enable = true;
|
||||||
|
openFirewall = true;
|
||||||
|
authKeyFile = cfg.keyFile;
|
||||||
|
extraUpFlags = [
|
||||||
|
"--login-server"
|
||||||
|
"https://mesh.cleslie.uk"
|
||||||
|
];
|
||||||
|
extraSetFlags = [(mkIf cfg.exitNode "--advertise-exit-node")];
|
||||||
|
};
|
||||||
|
networking.firewall = {
|
||||||
|
trustedInterfaces = [config.services.tailscale.interfaceName];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue