Parametrize the username a bit more
This commit is contained in:
parent
2d5b7e794a
commit
2caf4884db
|
@ -1050,11 +1050,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1710888565,
|
"lastModified": 1715381426,
|
||||||
"narHash": "sha256-s9Hi4RHhc6yut4EcYD50sZWRDKsugBJHSbON8KFwoTw=",
|
"narHash": "sha256-wPuqrAQGdv3ISs74nJfGb+Yprm23U/rFpcHFFNWgM94=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "f33900124c23c4eca5831b9b5eb32ea5894375ce",
|
"rev": "ab5542e9dbd13d0100f8baae2bc2d68af901f4b4",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
26
flake.nix
26
flake.nix
|
@ -79,6 +79,9 @@
|
||||||
|
|
||||||
outputs = { self, nixpkgs, home-manager, ... }@inputs:
|
outputs = { self, nixpkgs, home-manager, ... }@inputs:
|
||||||
let
|
let
|
||||||
|
# Main username
|
||||||
|
pilot = "adrielus";
|
||||||
|
|
||||||
# {{{ Common helpers
|
# {{{ Common helpers
|
||||||
inherit (self) outputs;
|
inherit (self) outputs;
|
||||||
forAllSystems = nixpkgs.lib.genAttrs [
|
forAllSystems = nixpkgs.lib.genAttrs [
|
||||||
|
@ -127,14 +130,14 @@
|
||||||
# NixOS configuration entrypoint
|
# NixOS configuration entrypoint
|
||||||
# Available through 'nixos-rebuild --flake .#...
|
# Available through 'nixos-rebuild --flake .#...
|
||||||
nixosConfigurations =
|
nixosConfigurations =
|
||||||
let nixos = { system, hostname, user }: nixpkgs.lib.nixosSystem {
|
let nixos = { system, hostname }: nixpkgs.lib.nixosSystem {
|
||||||
inherit system;
|
inherit system;
|
||||||
specialArgs = specialArgs system;
|
specialArgs = specialArgs system;
|
||||||
|
|
||||||
modules = [
|
modules = [
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
{
|
{
|
||||||
home-manager.users.${user} = import ./home/${hostname}.nix;
|
home-manager.users.pilot = import ./home/${hostname}.nix;
|
||||||
home-manager.extraSpecialArgs = specialArgs system // { inherit hostname; };
|
home-manager.extraSpecialArgs = specialArgs system // { inherit hostname; };
|
||||||
home-manager.useUserPackages = true;
|
home-manager.useUserPackages = true;
|
||||||
|
|
||||||
|
@ -150,13 +153,11 @@
|
||||||
tethys = nixos {
|
tethys = nixos {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
hostname = "tethys";
|
hostname = "tethys";
|
||||||
user = "adrielus";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
lapetus = nixos {
|
lapetus = nixos {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
hostname = "lapetus";
|
hostname = "lapetus";
|
||||||
user = "adrielus";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Disabled because `flake check` complains about filesystems and bootloader
|
# Disabled because `flake check` complains about filesystems and bootloader
|
||||||
|
@ -165,7 +166,6 @@
|
||||||
# euporie = nixos {
|
# euporie = nixos {
|
||||||
# system = "x86_64-linux";
|
# system = "x86_64-linux";
|
||||||
# hostname = "euporie";
|
# hostname = "euporie";
|
||||||
# user = "guest";
|
|
||||||
# };
|
# };
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -183,19 +183,7 @@
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
nixd = home-manager.lib.homeManagerConfiguration {
|
"${pilot}@tethys" = mkHomeConfig {
|
||||||
pkgs = nixpkgs.legacyPackages."x86_64-linux";
|
|
||||||
modules = [
|
|
||||||
({ lib, config, ... }: {
|
|
||||||
home = {
|
|
||||||
username = "adrielus";
|
|
||||||
homeDirectory = "/home/${config.home.username}";
|
|
||||||
stateVersion = "23.05";
|
|
||||||
};
|
|
||||||
})
|
|
||||||
];
|
|
||||||
};
|
|
||||||
"adrielus@tethys" = mkHomeConfig {
|
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
hostname = "tethys";
|
hostname = "tethys";
|
||||||
};
|
};
|
||||||
|
@ -203,7 +191,7 @@
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
hostname = "euporie";
|
hostname = "euporie";
|
||||||
};
|
};
|
||||||
"adrielus@lapetus" = mkHomeConfig {
|
"${pilot}@lapetus" = mkHomeConfig {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
hostname = "lapetus";
|
hostname = "lapetus";
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
programs.intray = {
|
programs.intray = {
|
||||||
enable = true;
|
enable = true;
|
||||||
data-dir = "/persist/state/home/adrielus/intray";
|
data-dir = "${config.satellite.persistence.at.state.home}/intray";
|
||||||
cache-dir = "/persist/local/cache/home/adrielus/intray";
|
cache-dir = "${config.satellite.persistence.at.cache.home}/intray";
|
||||||
config.sync = "AlwaysSync";
|
config.sync = "AlwaysSync";
|
||||||
sync = {
|
sync = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
@ -11,7 +11,7 @@ print_uptime() {
|
||||||
#
|
#
|
||||||
# For awk:
|
# For awk:
|
||||||
# -F: splits the input by a string
|
# -F: splits the input by a string
|
||||||
ssh adrielus@$HOST uptime \
|
ssh $USER@$HOST uptime \
|
||||||
| awk -F '(up |,)' '{print $2}'
|
| awk -F '(up |,)' '{print $2}'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
{
|
{ config, ... }: {
|
||||||
programs.ssh.enable = true;
|
programs.ssh.enable = true;
|
||||||
|
|
||||||
satellite.persistence.at.state.apps.ssh.directories = [ ".ssh" ];
|
satellite.persistence.at.state.apps.ssh.directories = [ ".ssh" ];
|
||||||
|
|
||||||
# Makes it easy to copy ssh keys at install time without messing up permissions
|
# Makes it easy to copy ssh keys at install time without messing up permissions
|
||||||
systemd.user.tmpfiles.rules = [ "d /persist/state/home/adrielus/ssh/.ssh/etc/ssh" ];
|
systemd.user.tmpfiles.rules = [
|
||||||
|
"d ${config.satellite.persistence.at.state.home}/ssh/.ssh/etc/ssh"
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ in
|
||||||
{
|
{
|
||||||
programs.discord = {
|
programs.discord = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableOpenASAR = false;
|
|
||||||
disableUpdateCheck = true;
|
disableUpdateCheck = true;
|
||||||
enableDevtools = true;
|
enableDevtools = true;
|
||||||
};
|
};
|
||||||
|
|
|
@ -48,7 +48,7 @@ in
|
||||||
PasswordManagerEnabled = false;
|
PasswordManagerEnabled = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
profiles.adrielus = {
|
profiles.${config.home.username} = {
|
||||||
# {{{ High level user settings
|
# {{{ High level user settings
|
||||||
# Unique user id
|
# Unique user id
|
||||||
id = 0;
|
id = 0;
|
||||||
|
@ -320,7 +320,7 @@ in
|
||||||
# TODO: uncomment when using newer version
|
# TODO: uncomment when using newer version
|
||||||
# stylix.targets.firefox = {
|
# stylix.targets.firefox = {
|
||||||
# enable = true;
|
# enable = true;
|
||||||
# profileNames = [ "adrielus" "desmos" "monkey-type" "syncthing" ];
|
# profileNames = [ config.home.username "desmos" "monkey-type" "syncthing" ];
|
||||||
# };
|
# };
|
||||||
|
|
||||||
# {{{ Make firefox the default
|
# {{{ Make firefox the default
|
||||||
|
|
|
@ -89,7 +89,7 @@ bind = $mod, L, exec, loginctl lock-session # Lock screen
|
||||||
bind = $mod, P, exec, anyrun
|
bind = $mod, P, exec, anyrun
|
||||||
bind = $mod, B, exec, wlsunset-toggle # Toggle blue light filter thingy
|
bind = $mod, B, exec, wlsunset-toggle # Toggle blue light filter thingy
|
||||||
bind = $mod, V, exec, wezterm start vimclip # Vim anywhere!
|
bind = $mod, V, exec, wezterm start vimclip # Vim anywhere!
|
||||||
bind = $mod, W, exec, /home/adrielus/projects/form-filler/type.sh
|
bind = $mod, W, exec, ~/projects/form-filler/type.sh
|
||||||
|
|
||||||
# Work with the special workspace
|
# Work with the special workspace
|
||||||
bind = $mod, x, togglespecialworkspace,
|
bind = $mod, x, togglespecialworkspace,
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
{ config, pkgs, lib, ... }: {
|
{ config, lib, ... }: {
|
||||||
home.packages = [ pkgs.hyprpaper ];
|
|
||||||
services.hyprpaper = {
|
services.hyprpaper = {
|
||||||
enable = true;
|
enable = true;
|
||||||
systemdTarget = "hyprland-session.target";
|
settings = {
|
||||||
|
preload = [ "${config.stylix.image}" ];
|
||||||
preload = [ config.stylix.image ];
|
wallpaper = [ ",${config.stylix.image}" ] ++
|
||||||
wallpapers = [{ inherit (config.stylix) image; }] ++
|
lib.forEach config.satellite.monitors ({ name, ... }:
|
||||||
lib.forEach config.satellite.monitors ({ name, ... }: {
|
"${name},${config.stylix.image}"
|
||||||
monitor = name;
|
);
|
||||||
image = config.stylix.image;
|
};
|
||||||
});
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ in
|
||||||
# {{{ Set reasonable defaults for some settings
|
# {{{ Set reasonable defaults for some settings
|
||||||
home = {
|
home = {
|
||||||
username = lib.mkDefault "adrielus";
|
username = lib.mkDefault "adrielus";
|
||||||
homeDirectory = lib.mkDefault "/home/${config.home.username}";
|
homeDirectory = "/home/${config.home.username}";
|
||||||
stateVersion = lib.mkDefault "23.05";
|
stateVersion = lib.mkDefault "23.05";
|
||||||
};
|
};
|
||||||
# }}}
|
# }}}
|
||||||
|
@ -68,9 +68,6 @@ in
|
||||||
# By default the paths given by sops contain annoying %r sections
|
# By default the paths given by sops contain annoying %r sections
|
||||||
sops.defaultSymlinkPath = "${config.home.homeDirectory}/.nix-sops";
|
sops.defaultSymlinkPath = "${config.home.homeDirectory}/.nix-sops";
|
||||||
|
|
||||||
# Allow root to read persistent files from this user.
|
|
||||||
home.persistence."/persist/home/adrielus".allowOther = true;
|
|
||||||
|
|
||||||
# {{{ Ad-hoc stylix targets
|
# {{{ Ad-hoc stylix targets
|
||||||
stylix.targets.xresources.enable = true;
|
stylix.targets.xresources.enable = true;
|
||||||
# }}}
|
# }}}
|
||||||
|
|
|
@ -19,10 +19,8 @@
|
||||||
# {{{ Create home directories
|
# {{{ Create home directories
|
||||||
systemd.tmpfiles.rules =
|
systemd.tmpfiles.rules =
|
||||||
let
|
let
|
||||||
users = lib.filter (v: v != null) [
|
users = lib.filter (v: v != null && v.isNormalUser)
|
||||||
(config.users.users.adrielus or null)
|
(lib.mapAttrsToList (_: u: u) config.users.users);
|
||||||
(config.users.users.guest or null)
|
|
||||||
];
|
|
||||||
|
|
||||||
mkHomePersistFor = location: lib.forEach users
|
mkHomePersistFor = location: lib.forEach users
|
||||||
(user: "Q ${location}${user.home} ${user.homeMode} ${user.name} ${user.group} -");
|
(user: "Q ${location}${user.home} ${user.homeMode} ${user.name} ${user.group} -");
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
--remember
|
--remember
|
||||||
--asterisks
|
--asterisks
|
||||||
'';
|
'';
|
||||||
user = "adrielus";
|
user = config.users.users.pilot.name;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
|
{ config, ... }:
|
||||||
let
|
let
|
||||||
user = "adrielus";
|
# Using `config.users.users.pilot.name` causes an infinite recursion error
|
||||||
|
# due to the way the syncthing module is written
|
||||||
|
user = config.satellite.pilot.name;
|
||||||
group = "syncthing";
|
group = "syncthing";
|
||||||
dataDir = "/persist/data/syncthing";
|
dataDir = "/persist/data/syncthing";
|
||||||
in
|
in
|
||||||
|
@ -9,7 +12,7 @@ in
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
openDefaultPorts = true;
|
openDefaultPorts = true;
|
||||||
configDir = "/persist/state/home/adrielus/syncthing/.config/syncthing";
|
configDir = "/persist/state/${config.users.users.pilot.home}/syncthing/.config/syncthing";
|
||||||
|
|
||||||
overrideDevices = true;
|
overrideDevices = true;
|
||||||
overrideFolders = true;
|
overrideFolders = true;
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
wireless: |
|
wireless: |
|
||||||
TG_HOTSPOT_HOME_PASS=...
|
TG_HOTSPOT_HOME_PASS=...
|
||||||
...
|
...
|
||||||
adrielus_password: ...
|
pilot_password: ...
|
||||||
cloudflare_dns_api_token: ...
|
cloudflare_dns_api_token: ...
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
wireless: ENC[AES256_GCM,data:Ib0PdBd2r/DPyE6Ah9NffT8Tw8c2y+seGFrE0e9GkyRaStdYMiiIlWCiaBO0u1HHaVV+2MQ33MnMdqyCGRlqGk45kl0GIwVR5iAiSYnobj/6wcse+kx/+5mzNOHXD1kJRGJBm5+SN9ntiGABNkQXJdn/Qoc/ukY1uaGe2nBeFKmGdD9JL7KfgdI5jYjQYyDbCL9JUszxkXNcplIRBAAy8JDaBVeo9HgI0QDIZToPKwuEeQoA9XzdimrjbCazlZy3ZvjAuoQXmrc1nIRHF5GabSRGTFTnTfcBeW2fGpUxmIhLyucn2DIQBXLm+RDdMLWoqcGbKiLVqKyUXck3ZZyoHMf2b9N52xMUwcS7,iv:ozkDwWmurWTD8TZHGvWL9Yh8cOrP1PzSBkz+1bBZybo=,tag:iGPjRaOoGRcOWJMweTL2yA==,type:str]
|
wireless: ENC[AES256_GCM,data:Ib0PdBd2r/DPyE6Ah9NffT8Tw8c2y+seGFrE0e9GkyRaStdYMiiIlWCiaBO0u1HHaVV+2MQ33MnMdqyCGRlqGk45kl0GIwVR5iAiSYnobj/6wcse+kx/+5mzNOHXD1kJRGJBm5+SN9ntiGABNkQXJdn/Qoc/ukY1uaGe2nBeFKmGdD9JL7KfgdI5jYjQYyDbCL9JUszxkXNcplIRBAAy8JDaBVeo9HgI0QDIZToPKwuEeQoA9XzdimrjbCazlZy3ZvjAuoQXmrc1nIRHF5GabSRGTFTnTfcBeW2fGpUxmIhLyucn2DIQBXLm+RDdMLWoqcGbKiLVqKyUXck3ZZyoHMf2b9N52xMUwcS7,iv:ozkDwWmurWTD8TZHGvWL9Yh8cOrP1PzSBkz+1bBZybo=,tag:iGPjRaOoGRcOWJMweTL2yA==,type:str]
|
||||||
adrielus_password: ENC[AES256_GCM,data:lREgbcKwzAJQ3PPTWt7LXmgAsrKFCN+baQx4Q2YrHlu16yvKpmaZzPHJ/C5IjucUNbdceTs6Ef99IWzju0d8Hl5Z5UTMspYIhQ==,iv:JqnL3zfCd/xMRqTciA/Q6nYmFKzJkBqda4zucsE5KFw=,tag:RGZ/0/NEpdchj9h/l3Z7Ig==,type:str]
|
pilot_password: ENC[AES256_GCM,data:PiKJCv5x68O9HFM4UvqLnsSPtqFslBLeAg67OkvFAbw7WaqbXh/p5SQblhPHcJ7jQDc4kI3XesOxruZrfJ0aZNDV1g7MWecgKg==,iv:EVs/m83Zfx2NRQMO52cF6pCe1ETpYfaR6lmXg2Na/DI=,tag:dl2x1aTsaTgtHEZYdW2lmg==,type:str]
|
||||||
cloudflare_dns_api_token: ENC[AES256_GCM,data:SAIMCvKOpGb5g9s03Xapc08KpOgLI+qlT5oiH/uNGxV+9JFSX3nvmQ==,iv:HFKcmHRG4EEOuJ8gRD0ZWsE18SLaZjewMSLznboLUeI=,tag:z21GURSxvNmZ4qkbri9mDQ==,type:str]
|
cloudflare_dns_api_token: ENC[AES256_GCM,data:SAIMCvKOpGb5g9s03Xapc08KpOgLI+qlT5oiH/uNGxV+9JFSX3nvmQ==,iv:HFKcmHRG4EEOuJ8gRD0ZWsE18SLaZjewMSLznboLUeI=,tag:z21GURSxvNmZ4qkbri9mDQ==,type:str]
|
||||||
sops:
|
sops:
|
||||||
kms: []
|
kms: []
|
||||||
|
@ -34,8 +34,8 @@ sops:
|
||||||
WFd4ZFNHWG5Cakw5cU9MRE9HWHQ4THMKr/S7v1Oj3zQziMtI/NuFVm6AaJF5JV5U
|
WFd4ZFNHWG5Cakw5cU9MRE9HWHQ4THMKr/S7v1Oj3zQziMtI/NuFVm6AaJF5JV5U
|
||||||
sEr2nEptYFz4G6YL5psQGXHaKzQKBg+crgKRbYL4akhqT7pfYPC0bQ==
|
sEr2nEptYFz4G6YL5psQGXHaKzQKBg+crgKRbYL4akhqT7pfYPC0bQ==
|
||||||
-----END AGE ENCRYPTED FILE-----
|
-----END AGE ENCRYPTED FILE-----
|
||||||
lastmodified: "2024-05-09T01:31:33Z"
|
lastmodified: "2024-05-20T18:01:20Z"
|
||||||
mac: ENC[AES256_GCM,data:W7sfnSzxLNAjdLtgwIlYhjaxa3gobh8El/cVggJTOiJVm1bC5TdLd0rUSh7J0UkvGj/lfPYjDDtYayaf09pjo8vLrZvH1SIy5wVF0ggcLM0tJxVqV8MDS+5pdUJiDOTfMiX1hyMBRH+N75PIqUMCte5x2zJg/79JMjch+E3NmA8=,iv:OAlKpC/2pz0ilwCNaBTsqTR/wNz6ZIVDgohDT8RvE5Y=,tag:VFAgHyr+DiWEeGaCSCh6og==,type:str]
|
mac: ENC[AES256_GCM,data:6B+Oo7R2QhfD/1Nv+RMafWvoOTyC6qefFrdgfVu5DjSoAjucWV+8d0l5KgFude3ju4WWDi+Jv4boN/0pGEmgqaztTiSuLStzSoVcqYSUxHxSLjl2XJycqptcFN37GUCqCpyRpN6me1sylaTqbCUtd2acd+v/9Z12bXiGGvNY+Qc=,iv:6VGZmHbMFlCjkKIN8gvkJYQjQsIF0gQZQ1WNpn01UHk=,tag:3uvqMXaG/A/qqq9LRlR27w==,type:str]
|
||||||
pgp: []
|
pgp: []
|
||||||
unencrypted_suffix: _unencrypted
|
unencrypted_suffix: _unencrypted
|
||||||
version: 3.8.1
|
version: 3.8.1
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# For more comments check out [adrielus](./adrielus.nix)
|
# For more comments check out [pilot](./pilot.nix)
|
||||||
{ pkgs, outputs, lib, ... }:
|
{ pkgs, outputs, lib, ... }:
|
||||||
{
|
{
|
||||||
users.mutableUsers = false;
|
users.mutableUsers = false;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
{ pkgs, outputs, config, lib, ... }:
|
{ pkgs, outputs, config, lib, ... }:
|
||||||
{
|
{
|
||||||
sops.secrets.adrielus_password = {
|
satellite.pilot.name = "adrielus";
|
||||||
|
|
||||||
|
sops.secrets.pilot_password = {
|
||||||
sopsFile = ../secrets.yaml;
|
sopsFile = ../secrets.yaml;
|
||||||
neededForUsers = true;
|
neededForUsers = true;
|
||||||
};
|
};
|
||||||
|
@ -9,13 +11,14 @@
|
||||||
# Configure users through nix only
|
# Configure users through nix only
|
||||||
mutableUsers = false;
|
mutableUsers = false;
|
||||||
|
|
||||||
# Create an user named adrielus
|
users.pilot = {
|
||||||
users.adrielus = {
|
inherit (config.satellite.pilot) name;
|
||||||
|
|
||||||
# Adds me to some default groups, and creates the home dir
|
# Adds me to some default groups, and creates the home dir
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
|
|
||||||
# Picked up by our persistence module
|
# Picked up by our persistence module
|
||||||
homeMode = "755";
|
homeMode = "700";
|
||||||
|
|
||||||
# Add user to the following groups
|
# Add user to the following groups
|
||||||
extraGroups = [
|
extraGroups = [
|
||||||
|
@ -27,7 +30,7 @@
|
||||||
"syncthing" # syncthing!
|
"syncthing" # syncthing!
|
||||||
];
|
];
|
||||||
|
|
||||||
hashedPasswordFile = config.sops.secrets.adrielus_password.path;
|
hashedPasswordFile = config.sops.secrets.pilot_password.path;
|
||||||
shell = pkgs.fish;
|
shell = pkgs.fish;
|
||||||
|
|
||||||
openssh.authorizedKeys.keyFiles =
|
openssh.authorizedKeys.keyFiles =
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../common/global
|
../common/global
|
||||||
../common/users/adrielus.nix
|
../common/users/pilot.nix
|
||||||
../common/optional/services/kanata.nix
|
../common/optional/services/kanata.nix
|
||||||
|
|
||||||
./services/syncthing.nix
|
./services/syncthing.nix
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
let
|
let
|
||||||
port = 8417;
|
port = 8417;
|
||||||
dataDir = "/persist/data/home/adrielus/media";
|
dataDir = "/persist/data/${config.users.users.pilot.home}/media";
|
||||||
configDir = "/persist/state/var/lib/qbittorrent";
|
configDir = "/persist/state/var/lib/qbittorrent";
|
||||||
vpnConfigDir = "/persist/state/var/lib/openvpn";
|
vpnConfigDir = "/persist/state/var/lib/openvpn";
|
||||||
in
|
in
|
||||||
|
|
|
@ -36,4 +36,12 @@
|
||||||
# }}}
|
# }}}
|
||||||
};
|
};
|
||||||
# }}}
|
# }}}
|
||||||
|
# {{{ Syncoid
|
||||||
|
# Automatically sync certain snapshot to rsync.net
|
||||||
|
services.syncoid = {
|
||||||
|
enable = true;
|
||||||
|
commands."zroot/root/persist/data".target = "root@rsync.net:zroot/root/persist/data";
|
||||||
|
commands."zroot/root/persist/state".target = "root@rsync.net:zroot/root/persist/state";
|
||||||
|
};
|
||||||
|
# }}}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# {{{ Imports
|
# {{{ Imports
|
||||||
imports = [
|
imports = [
|
||||||
../common/global
|
../common/global
|
||||||
../common/users/adrielus.nix
|
../common/users/pilot.nix
|
||||||
|
|
||||||
../common/optional/pipewire.nix
|
../common/optional/pipewire.nix
|
||||||
../common/optional/bluetooth.nix
|
../common/optional/bluetooth.nix
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
{ config, ... }:
|
||||||
let commonVersioning = {
|
let commonVersioning = {
|
||||||
type = "staggered";
|
type = "staggered";
|
||||||
params = {
|
params = {
|
||||||
|
@ -11,7 +12,7 @@ in
|
||||||
|
|
||||||
services.syncthing.settings.folders = {
|
services.syncthing.settings.folders = {
|
||||||
"stellar-sanctum" = {
|
"stellar-sanctum" = {
|
||||||
path = "/home/adrielus/projects/stellar-sanctum/";
|
path = "${config.users.users.pilot.home}/projects/stellar-sanctum/";
|
||||||
devices = [ "enceladus" "lapetus" ];
|
devices = [ "enceladus" "lapetus" ];
|
||||||
versioning = commonVersioning;
|
versioning = commonVersioning;
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,34 +7,35 @@ This directory contains custom module definitions used throughout my config.
|
||||||
| Directory | Description |
|
| Directory | Description |
|
||||||
| ------------------------------ | -------------------------------------------------------------- |
|
| ------------------------------ | -------------------------------------------------------------- |
|
||||||
| [common](./common) | Modules usable in both HM and nixos (and perhaps other places) |
|
| [common](./common) | Modules usable in both HM and nixos (and perhaps other places) |
|
||||||
| [nixos](./nixos) | Nixos specific functionality |
|
| [nixos](./nixos) | Nixos specific functionality |
|
||||||
| [home-manager](./home-manager) | Home manager specific functionality |
|
| [home-manager](./home-manager) | Home manager specific functionality |
|
||||||
|
|
||||||
## Common modules
|
## Common modules
|
||||||
|
|
||||||
| Name | Attribute | Description | Dependencies |
|
| Name | Attribute | Description |
|
||||||
| ----------------------------------------------- | --------------------------- | ---------------------------------------- | ---------------------------------------------- |
|
| ----------------------------------------------- | --------------------------- | --------------------------------------------------------------------------------------------- |
|
||||||
| [lua-colorscheme](./common/lua-colorscheme.nix) | `satellite.colorscheme.lua` | Base16 theme to lua module generation | [stylix](https://github.com/danth/stylix) |
|
| [toggles](./common/toggles.nix) | `satellite.toggles` | Generic interface for feature flags |
|
||||||
| [lua-lib](./common/lua-lib.nix) | `satellite.lib.lua` | Helpers for working with lua code | |
|
| [lua-lib](./common/lua-lib.nix) | `satellite.lib.lua` | Helpers for working with lua code |
|
||||||
| [korora-lua](./common/korora-lua.nix) | - | Nix -> lua encoder | [korora](https://github.com/adisbladis/korora) |
|
| [korora-lua](./common/korora-lua.nix) | - | Nix -> lua encoder typechecked using [korora](https://github.com/adisbladis/korora) |
|
||||||
| [korora-neovim](./common/korora-neovim.nix) | - | Nix -> neovim config helpers | [korora](https://github.com/adisbladis/korora) |
|
| [korora-neovim](./common/korora-neovim.nix) | - | Nix -> neovim config helpers typechecked using [korora](https://github.com/adisbladis/korora) |
|
||||||
| [theming](./common/theming.nix) | `satellite.theming` | Base16 theming helpers and configuration | [stylix](https://github.com/danth/stylix) |
|
| [theming](./common/theming.nix) | `satellite.theming` | [stylix](https://github.com/danth/stylix) theming helpers and configuration |
|
||||||
| [toggles](./common/toggles.nix) | `satellite.toggles` | Generic interface for feature flags | |
|
| [lua-colorscheme](./common/lua-colorscheme.nix) | `satellite.colorscheme.lua` | Base16 theme to lua module generation |
|
||||||
|
|
||||||
## Nixos modules
|
## Nixos modules
|
||||||
|
|
||||||
| Name | Attribute | Description | Dependencies |
|
| Name | Attribute | Description |
|
||||||
| ---------------------------- | ----------------- | ---------------------------------------- | ------------ |
|
| -------------------------------------- | ----------------------- | ------------------------------------------- |
|
||||||
| [pounce](./nixos/pounce.nix) | `services.pounce` | Module for pounce & calico configuration | |
|
| [pounce](./nixos/pounce.nix) | `services.pounce` | Module for pounce & calico configuration |
|
||||||
| [nginx](./nixos/nginx.nix) | `satellite.proxy` | Helpers for nginx configuration | |
|
| [nginx](./nixos/nginx.nix) | `satellite.proxy` | Helpers for nginx configuration |
|
||||||
|
| [cloudflared](./nixos/cloudflared.nix) | `satellite.cloudflared` | Helpers for cloudflare tunnel configuration |
|
||||||
|
| [pilot](./nixos/pilot.nix) | `satellite.pilot` | Defined the concept of a "main user" |
|
||||||
|
|
||||||
## Home-manager modules
|
## Home-manager modules
|
||||||
|
|
||||||
| Name | Attribute | Description | Dependencies |
|
| Name | Attribute | Description |
|
||||||
| ------------------------------------------------- | ----------------------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------- |
|
| ------------------------------------------------- | ----------------------- | -------------------------------------------------------------------------------------- |
|
||||||
| [discord](./home-manager/discord.nix) | `programs.discord` | Additional discord options | |
|
| [discord](./home-manager/discord.nix) | `programs.discord` | Additional discord options |
|
||||||
| [firefox](./home-manager/firefox) | `programs.firefox.apps` | Hacky system for wrapping websites into desktop apps by hiding the firefox tabbar | |
|
| [firefox](./home-manager/firefox) | `programs.firefox.apps` | Hacky system for wrapping websites into desktop apps by hiding the firefox tabbar |
|
||||||
| [hyprpaper](./home-manager/hyprpaper.nix) | `services.hyprpaper` | Wallpaper service for `hyprland` | |
|
| [monitors](./home-manager/monitors.nix) | `satellite.monitors` | WM generic monitor configuration |
|
||||||
| [monitors](./home-manager/monitors.nix) | `satellite.monitors` | WM generic monitor configuration | |
|
| [persistence](./home-manager/persistence.nix) | `satellite.persistence` | Syntactic wrapper around [impermanence](https://github.com/nix-community/impermanence) |
|
||||||
| [persistence](./home-manager/persistence.nix) | `satellite.persistence` | Syntactic wrapper around impermanence | [impermanence](https://github.com/nix-community/impermanence) |
|
| [satellite-dev](./home-manager/satellite-dev.nix) | `satellite.dev` | Helpers for managing dotfiles which are actively under development |
|
||||||
| [satellite-dev](./home-manager/satellite-dev.nix) | `satellite.dev` | Helpers for managing dotfiles which are actively under development | |
|
|
||||||
|
|
135
modules/home-manager/compat/hyprpaper.nix
Normal file
135
modules/home-manager/compat/hyprpaper.nix
Normal file
|
@ -0,0 +1,135 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.services.hyprpaper;
|
||||||
|
toHyprconf = { attrs, indentLevel ? 0, importantPrefixes ? [ "$" ], }:
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
all concatMapStringsSep concatStrings concatStringsSep filterAttrs foldl
|
||||||
|
generators hasPrefix isAttrs isList mapAttrsToList replicate;
|
||||||
|
|
||||||
|
initialIndent = concatStrings (replicate indentLevel " ");
|
||||||
|
|
||||||
|
toHyprconf' = indent: attrs:
|
||||||
|
let
|
||||||
|
sections =
|
||||||
|
filterAttrs (n: v: isAttrs v || (isList v && all isAttrs v)) attrs;
|
||||||
|
|
||||||
|
mkSection = n: attrs:
|
||||||
|
if lib.isList attrs then
|
||||||
|
(concatMapStringsSep "\n" (a: mkSection n a) attrs)
|
||||||
|
else ''
|
||||||
|
${indent}${n} {
|
||||||
|
${toHyprconf' " ${indent}" attrs}${indent}}
|
||||||
|
'';
|
||||||
|
|
||||||
|
mkFields = generators.toKeyValue {
|
||||||
|
listsAsDuplicateKeys = true;
|
||||||
|
inherit indent;
|
||||||
|
};
|
||||||
|
|
||||||
|
allFields =
|
||||||
|
filterAttrs (n: v: !(isAttrs v || (isList v && all isAttrs v)))
|
||||||
|
attrs;
|
||||||
|
|
||||||
|
isImportantField = n: _:
|
||||||
|
foldl (acc: prev: if hasPrefix prev n then true else acc) false
|
||||||
|
importantPrefixes;
|
||||||
|
|
||||||
|
importantFields = filterAttrs isImportantField allFields;
|
||||||
|
|
||||||
|
fields = builtins.removeAttrs allFields
|
||||||
|
(mapAttrsToList (n: _: n) importantFields);
|
||||||
|
in
|
||||||
|
mkFields importantFields
|
||||||
|
+ concatStringsSep "\n" (mapAttrsToList mkSection sections)
|
||||||
|
+ mkFields fields;
|
||||||
|
in
|
||||||
|
toHyprconf' initialIndent attrs;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
meta.maintainers = [ maintainers.khaneliman maintainers.fufexan ];
|
||||||
|
|
||||||
|
options.services.hyprpaper = {
|
||||||
|
enable = mkEnableOption "Hyprpaper, Hyprland's wallpaper daemon";
|
||||||
|
|
||||||
|
package = mkPackageOption pkgs "hyprpaper" { };
|
||||||
|
|
||||||
|
settings = lib.mkOption {
|
||||||
|
type = with lib.types;
|
||||||
|
let
|
||||||
|
valueType = nullOr
|
||||||
|
(oneOf [
|
||||||
|
bool
|
||||||
|
int
|
||||||
|
float
|
||||||
|
str
|
||||||
|
path
|
||||||
|
(attrsOf valueType)
|
||||||
|
(listOf valueType)
|
||||||
|
]) // {
|
||||||
|
description = "Hyprpaper configuration value";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
valueType;
|
||||||
|
default = { };
|
||||||
|
description = ''
|
||||||
|
hyprpaper configuration written in Nix. Entries with the same key
|
||||||
|
should be written as lists. Variables' and colors' names should be
|
||||||
|
quoted. See <https://wiki.hyprland.org/Hypr-Ecosystem/hyprpaper/> for more examples.
|
||||||
|
'';
|
||||||
|
example = lib.literalExpression ''
|
||||||
|
{
|
||||||
|
ipc = "on";
|
||||||
|
splash = false;
|
||||||
|
splash_offset = 2.0;
|
||||||
|
|
||||||
|
preload =
|
||||||
|
[ "/share/wallpapers/buttons.png" "/share/wallpapers/cat_pacman.png" ];
|
||||||
|
|
||||||
|
wallpaper = [
|
||||||
|
"DP-3,/share/wallpapers/buttons.png"
|
||||||
|
"DP-1,/share/wallpapers/cat_pacman.png"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
importantPrefixes = lib.mkOption {
|
||||||
|
type = with lib.types; listOf str;
|
||||||
|
default = [ "$" ];
|
||||||
|
example = [ "$" ];
|
||||||
|
description = ''
|
||||||
|
List of prefix of attributes to source at the top of the config.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
xdg.configFile."hypr/hyprpaper.conf" = mkIf (cfg.settings != { }) {
|
||||||
|
text = toHyprconf {
|
||||||
|
attrs = cfg.settings;
|
||||||
|
inherit (cfg) importantPrefixes;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.user.services.hyprpaper = {
|
||||||
|
Install = { WantedBy = [ "graphical-session.target" ]; };
|
||||||
|
|
||||||
|
Unit = {
|
||||||
|
ConditionEnvironment = "WAYLAND_DISPLAY";
|
||||||
|
Description = "hyprpaper";
|
||||||
|
After = [ "graphical-session-pre.target" ];
|
||||||
|
PartOf = [ "graphical-session.target" ];
|
||||||
|
X-Restart-Triggers =
|
||||||
|
[ "${config.xdg.configFile."hypr/hyprpaper.conf".source}" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
Service = {
|
||||||
|
ExecStart = "${getExe cfg.package}";
|
||||||
|
Restart = "always";
|
||||||
|
RestartSec = "10";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -3,16 +3,17 @@
|
||||||
{
|
{
|
||||||
# example = import ./example.nix;
|
# example = import ./example.nix;
|
||||||
|
|
||||||
|
# Modules not yet added to the stable branch
|
||||||
bemenu = import ./compat/bemenu.nix;
|
bemenu = import ./compat/bemenu.nix;
|
||||||
|
hyprpaper = import ./compat/hyprpaper.nix;
|
||||||
k9s = import ./compat/k9s.nix;
|
k9s = import ./compat/k9s.nix;
|
||||||
|
|
||||||
# Personal things
|
# Personal things
|
||||||
|
dev = import ./dev.nix;
|
||||||
firefox = import ./firefox;
|
firefox = import ./firefox;
|
||||||
monitors = import ./monitors.nix;
|
monitors = import ./monitors.nix;
|
||||||
satellite-dev = import ./satellite-dev.nix;
|
|
||||||
satellite-persistence = import ./persistence.nix;
|
satellite-persistence = import ./persistence.nix;
|
||||||
|
|
||||||
# Should upstream
|
# Should upstream
|
||||||
discord = import ./discord.nix;
|
discord = import ./discord.nix;
|
||||||
hyprpaper = import ./hyprpaper.nix;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ in
|
||||||
{
|
{
|
||||||
options.programs.discord = {
|
options.programs.discord = {
|
||||||
enable = lib.mkEnableOption "Discord";
|
enable = lib.mkEnableOption "Discord";
|
||||||
enableOpenASAR = lib.mkEnableOption "openASAR";
|
|
||||||
disableUpdateCheck = lib.mkEnableOption "update skipping";
|
disableUpdateCheck = lib.mkEnableOption "update skipping";
|
||||||
enableDevtools = lib.mkEnableOption "devtools";
|
enableDevtools = lib.mkEnableOption "devtools";
|
||||||
|
|
||||||
|
@ -16,19 +15,13 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
home.packages =
|
home.packages = [ cfg.package ];
|
||||||
[
|
|
||||||
(if cfg.enableOpenASAR
|
|
||||||
then cfg.package.override { withOpenASAR = true; }
|
|
||||||
else cfg.package)
|
|
||||||
];
|
|
||||||
|
|
||||||
xdg.configFile."discord/settings.json".text =
|
xdg.configFile."discord/settings.json".text =
|
||||||
builtins.toJSON
|
builtins.toJSON {
|
||||||
{
|
SKIP_HOST_UPDATE = cfg.disableUpdateCheck;
|
||||||
SKIP_HOST_UPDATE = cfg.disableUpdateCheck;
|
DANGEROUS_ENABLE_DEVTOOLS_ONLY_ENABLE_IF_YOU_KNOW_WHAT_YOURE_DOING = cfg.enableDevtools;
|
||||||
DANGEROUS_ENABLE_DEVTOOLS_ONLY_ENABLE_IF_YOU_KNOW_WHAT_YOURE_DOING = cfg.enableDevtools;
|
};
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,113 +0,0 @@
|
||||||
# TODO: add maintainers and upstream into home-manager
|
|
||||||
{ config, lib, pkgs, ... }:
|
|
||||||
|
|
||||||
with lib;
|
|
||||||
|
|
||||||
let
|
|
||||||
cfg = config.services.hyprpaper;
|
|
||||||
mkWallpaper = { mode, image, monitor, ... }:
|
|
||||||
let
|
|
||||||
monitorString = lib.optionalString (monitor != null) monitor;
|
|
||||||
modeString = lib.optionalString (mode == "contain") "contain:";
|
|
||||||
in
|
|
||||||
"wallpaper=${monitorString},${modeString}${image}";
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options.services.hyprpaper = {
|
|
||||||
enable = mkEnableOption "hyprpaper";
|
|
||||||
|
|
||||||
package = mkOption {
|
|
||||||
type = types.package;
|
|
||||||
default = pkgs.hyprpaper;
|
|
||||||
defaultText = "pkgs.hyprpaper";
|
|
||||||
description = ''
|
|
||||||
hyprpaper derivation to use.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
# TODO: what should the default value be for this?
|
|
||||||
systemdTarget = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
description = ''
|
|
||||||
Systemd target to bind to.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
preload = mkOption {
|
|
||||||
type = types.listOf (types.oneOf [ types.str types.path ]);
|
|
||||||
default = [ ];
|
|
||||||
example = [ "~/background.png" ];
|
|
||||||
description = "List of images to preload";
|
|
||||||
};
|
|
||||||
|
|
||||||
wallpapers = mkOption {
|
|
||||||
type = types.listOf (types.submodule (_: {
|
|
||||||
options = {
|
|
||||||
monitor = mkOption {
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
default = null;
|
|
||||||
example = "eDP-1";
|
|
||||||
description = ''
|
|
||||||
Monitor to use for the wallpaper.
|
|
||||||
Either leave empty as a wildcard,
|
|
||||||
type the name of the monitor, or
|
|
||||||
include the monitor's description
|
|
||||||
prefixed with `desc:`.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
image = mkOption {
|
|
||||||
type = types.oneOf [ types.str types.path ];
|
|
||||||
default = null;
|
|
||||||
example = "~/background.png";
|
|
||||||
description = "Image to use as wallpaper";
|
|
||||||
};
|
|
||||||
|
|
||||||
mode = mkOption {
|
|
||||||
type = lib.types.enum [ "cover" "contain" ];
|
|
||||||
default = "cover";
|
|
||||||
example = "contain";
|
|
||||||
description = "The way to display the wallpaper";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}));
|
|
||||||
|
|
||||||
default = [ ];
|
|
||||||
description = "List of wallpapers to set";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
|
||||||
assertions = [
|
|
||||||
(lib.hm.assertions.assertPlatform "services.hyprpaper" pkgs
|
|
||||||
lib.platforms.linux)
|
|
||||||
];
|
|
||||||
|
|
||||||
xdg.configFile."hypr/hyprpaper.conf" = {
|
|
||||||
text = ''
|
|
||||||
${lib.concatStringsSep "\n" (lib.forEach cfg.preload (image: "preload=${image}"))}
|
|
||||||
${lib.concatStringsSep "\n" (lib.forEach cfg.wallpapers mkWallpaper)}
|
|
||||||
splash=true
|
|
||||||
'';
|
|
||||||
|
|
||||||
onChange = (pkgs.writeShellScript "reload_hyprpaper" ''
|
|
||||||
${pkgs.systemd}/bin/systemctl --user restart hyprpaper.service
|
|
||||||
'').outPath;
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.user.services.hyprpaper = {
|
|
||||||
Unit = {
|
|
||||||
Description = "Hyprland wallpaper daemon";
|
|
||||||
Requires = [ "graphical-session.target" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
Service = {
|
|
||||||
ExecStart = "${cfg.package}/bin/hyprpaper";
|
|
||||||
};
|
|
||||||
|
|
||||||
Install = {
|
|
||||||
WantedBy = [ cfg.systemdTarget ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -3,33 +3,49 @@
|
||||||
let cfg = config.satellite.persistence;
|
let cfg = config.satellite.persistence;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
# {{{ Option definition
|
||||||
options.satellite.persistence = {
|
options.satellite.persistence = {
|
||||||
enable = lib.mkEnableOption "satellite persitence";
|
enable = lib.mkEnableOption "satellite persistence";
|
||||||
|
|
||||||
at = lib.mkOption {
|
at = lib.mkOption {
|
||||||
default = { };
|
default = { };
|
||||||
description = "Record of persistent locations (eg: /persist)";
|
description = "Record of persistent locations (eg: /persist)";
|
||||||
type = lib.types.attrsOf (lib.types.submodule (_: {
|
type = lib.types.attrsOf (lib.types.submodule (args: {
|
||||||
|
config = {
|
||||||
|
home = "${args.config.path}${config.home.homeDirectory}";
|
||||||
|
};
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
# {{{ Location options
|
||||||
path = lib.mkOption {
|
path = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
example = "/persist";
|
example = "/persist";
|
||||||
default = null;
|
description = "The root location to store the home directory for files in this record";
|
||||||
description = "The location to store the files described in this record";
|
};
|
||||||
|
|
||||||
|
home = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "The path to the home directory for files in this record";
|
||||||
};
|
};
|
||||||
|
|
||||||
prefixDirectories = lib.mkOption {
|
prefixDirectories = lib.mkOption {
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
example = false;
|
|
||||||
description = "Whether to enable gnu/stow type prefix directories";
|
description = "Whether to enable gnu/stow type prefix directories";
|
||||||
};
|
};
|
||||||
|
# }}}
|
||||||
|
# {{{ Apps
|
||||||
apps = lib.mkOption {
|
apps = lib.mkOption {
|
||||||
default = { };
|
default = { };
|
||||||
description = "The apps to be stores in this persistent location";
|
description = "Record of gnu/stow-style apps to be stored in this location";
|
||||||
type = lib.types.attrsOf (lib.types.submodule (_: {
|
type = lib.types.attrsOf (lib.types.submodule ({ name, ... }: {
|
||||||
options = {
|
options = {
|
||||||
|
name = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = name;
|
||||||
|
description = "The gnu/stow-style subdirectory name";
|
||||||
|
};
|
||||||
|
|
||||||
files = lib.mkOption {
|
files = lib.mkOption {
|
||||||
type = lib.types.listOf lib.types.str;
|
type = lib.types.listOf lib.types.str;
|
||||||
default = [ ];
|
default = [ ];
|
||||||
|
@ -37,18 +53,21 @@ in
|
||||||
description = ''
|
description = ''
|
||||||
A list of files in your home directory you want to
|
A list of files in your home directory you want to
|
||||||
link to persistent storage. Allows both absolute paths
|
link to persistent storage. Allows both absolute paths
|
||||||
and paths relative to the home directory. .
|
and paths relative to the home directory.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
directories = lib.mkOption {
|
directories = lib.mkOption {
|
||||||
default = [ ];
|
default = [ ];
|
||||||
description = "Modified version of home.persistence.*.directories which takes in absolute paths";
|
description = ''
|
||||||
|
Modified version of `home.persistence.*.directories` which takes in absolute paths.
|
||||||
|
'';
|
||||||
|
|
||||||
type = lib.types.listOf (lib.types.either lib.types.str (lib.types.submodule {
|
type = lib.types.listOf (lib.types.either lib.types.str (lib.types.submodule {
|
||||||
options = {
|
options = {
|
||||||
directory = lib.mkOption {
|
directory = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = null;
|
example = "/home/username/.config/nvim";
|
||||||
description = "The directory path to be linked.";
|
description = "The directory path to be linked.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -68,23 +87,27 @@ in
|
||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
# }}}
|
||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
# }}}
|
||||||
|
# {{{ Config generation
|
||||||
config =
|
config =
|
||||||
let
|
let
|
||||||
makeLocation = location:
|
makeLocation = location:
|
||||||
let
|
let
|
||||||
processPath = appName: value:
|
# {{{ Path processing
|
||||||
|
processPath = appName: path:
|
||||||
let
|
let
|
||||||
suffix = "${lib.strings.removePrefix "${config.home.homeDirectory}/" (builtins.toString value)}";
|
suffix = "${lib.strings.removePrefix "${config.home.homeDirectory}/" (builtins.toString path)}";
|
||||||
prefix = if location.prefixDirectories then "${appName}/" else "";
|
prefix = if location.prefixDirectories then "${appName}/" else "";
|
||||||
in
|
in
|
||||||
# lib.debug.traceSeq "\nProcessing path at location ${location.path} and app ${appName} from original path ${value} to ${prefix + suffix}"
|
# lib.debug.traceSeq "\nProcessing path at location ${location.path} and app ${appName} from original path ${value} to ${prefix + suffix}"
|
||||||
(prefix + suffix);
|
(prefix + suffix);
|
||||||
|
# }}}
|
||||||
|
# {{{ Constructors
|
||||||
mkDirectory = appName: directory:
|
mkDirectory = appName: directory:
|
||||||
if builtins.isAttrs directory then {
|
if builtins.isAttrs directory then {
|
||||||
method = directory.method;
|
method = directory.method;
|
||||||
|
@ -92,20 +115,24 @@ in
|
||||||
}
|
}
|
||||||
else processPath appName directory;
|
else processPath appName directory;
|
||||||
|
|
||||||
mkAppDirectory = appName: app: builtins.map (mkDirectory appName) app.directories;
|
mkAppDirectory = app: builtins.map (mkDirectory app.name) app.directories;
|
||||||
mkAppFiles = appName: app: builtins.map (processPath appName) app.files;
|
mkAppFiles = app: builtins.map (processPath app.name) app.files;
|
||||||
|
# }}}
|
||||||
in
|
in
|
||||||
lib.attrsets.nameValuePair (location.path + config.home.homeDirectory) {
|
# {{{ Impermanence config generation
|
||||||
|
lib.attrsets.nameValuePair location.home {
|
||||||
removePrefixDirectory = location.prefixDirectories;
|
removePrefixDirectory = location.prefixDirectories;
|
||||||
allowOther = true;
|
allowOther = true;
|
||||||
directories = lib.lists.flatten
|
directories = lib.lists.flatten
|
||||||
(lib.attrsets.mapAttrsToList mkAppDirectory location.apps);
|
(lib.attrsets.mapAttrsToList (_: mkAppDirectory) location.apps);
|
||||||
|
|
||||||
files = lib.lists.flatten
|
files = lib.lists.flatten
|
||||||
(lib.attrsets.mapAttrsToList mkAppFiles location.apps);
|
(lib.attrsets.mapAttrsToList (_: mkAppFiles) location.apps);
|
||||||
};
|
};
|
||||||
|
# }}}
|
||||||
in
|
in
|
||||||
lib.mkIf cfg.enable {
|
lib.mkIf cfg.enable {
|
||||||
home.persistence = lib.attrsets.mapAttrs' (_: makeLocation) cfg.at;
|
home.persistence = lib.attrsets.mapAttrs' (_: makeLocation) cfg.at;
|
||||||
};
|
};
|
||||||
|
# }}}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
# example = import ./example.nix;
|
# example = import ./example.nix;
|
||||||
cloudflaredd = import ./cloudflared.nix;
|
cloudflared = import ./cloudflared.nix;
|
||||||
nginx = import ./nginx.nix;
|
nginx = import ./nginx.nix;
|
||||||
|
pilot = import ./pilot.nix;
|
||||||
pounce = import ./pounce.nix;
|
pounce = import ./pounce.nix;
|
||||||
}
|
}
|
||||||
|
|
8
modules/nixos/pilot.nix
Normal file
8
modules/nixos/pilot.nix
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{ lib, ... }: {
|
||||||
|
options.satellite.pilot = {
|
||||||
|
name = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "The name of the main user for this machine, as defined by `users.users.\${name}`";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -34,8 +34,7 @@ in
|
||||||
# {{{ Options
|
# {{{ Options
|
||||||
options.services.pounce = {
|
options.services.pounce = {
|
||||||
# {{{ general options
|
# {{{ general options
|
||||||
enable = mkEnableOption
|
enable = mkEnableOption "the Pounce IRC bouncer and Calico dispatcher";
|
||||||
(lib.mdDoc "the Pounce IRC bouncer and Calico dispatcher");
|
|
||||||
|
|
||||||
user = mkOption {
|
user = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
|
|
Loading…
Reference in a new issue