Merge branch 'master' of git.2li.ch:Nebucatnetzer/nixos

This commit is contained in:
Andreas Zweili 2022-02-23 10:23:02 +01:00
commit 980c6ab3f9
22 changed files with 107 additions and 87 deletions

4
custom/default.nix Normal file
View File

@ -0,0 +1,4 @@
{
username = "andreas";
system = "x86_64-linux";
}

View File

@ -22,11 +22,11 @@
, home-manager
}:
let
system = "x86_64-linux";
username = "andreas";
custom = import ./custom;
system = custom.system;
overlay-unstable = final: prev: {
unstable = import nixpkgs-unstable {
system = "x86_64-linux";
system = custom.system;
config.allowUnfree = true;
};
};
@ -42,7 +42,7 @@
};
mkComputer = configurationNix: homeManagerRole: extraModules: nixpkgs.lib.nixosSystem {
inherit system pkgs;
specialArgs = { inherit self nixpkgs system inputs username; };
specialArgs = { inherit custom inputs; };
modules = (
[
# System configuration for this host
@ -55,8 +55,8 @@
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.${username}.imports = [
(import homeManagerRole { inherit pkgs username; })
home-manager.users.${custom.username}.imports = [
(import homeManagerRole { inherit custom pkgs inputs; })
];
}
] ++ extraModules
@ -107,140 +107,140 @@
];
proxy = mkComputer
(mkVM
{ hostname = "proxy"; ip = "10.7.89.100"; inherit self; })
{ hostname = "proxy"; ip = "10.7.89.100"; inherit custom inputs; })
./home-manager/headless.nix
[
./modules/haproxy
];
nixos-management = mkComputer
(mkVM
{ hostname = "nixos-management"; ip = "10.7.89.150"; inherit self; })
{ hostname = "nixos-management"; ip = "10.7.89.150"; inherit custom inputs; })
./home-manager/headless.nix
[
./modules/code-server
./modules/docker
(import ./modules/restic-server-client {
inherit self username; time = "21:30";
inherit custom inputs; time = "21:30";
})
];
heimdall = mkComputer
(mkVM
{ hostname = "heimdall"; ip = "10.7.89.121"; inherit self; })
{ hostname = "heimdall"; ip = "10.7.89.121"; inherit custom inputs; })
./home-manager/headless.nix
[
./modules/docker
(import ./modules/restic-server-client {
inherit self username; time = "22:00";
inherit custom inputs; time = "22:00";
})
];
grav = mkComputer
(mkVM
{ hostname = "grav"; ip = "10.7.89.102"; inherit self; })
{ hostname = "grav"; ip = "10.7.89.102"; inherit custom inputs; })
./home-manager/headless.nix
[
./modules/docker
(import ./modules/restic-server-client {
inherit self username; time = "22:30";
inherit custom inputs; time = "22:30";
})
];
ttrss = mkComputer
(mkVM
{ hostname = "ttrss"; ip = "10.7.89.115"; inherit self; })
{ hostname = "ttrss"; ip = "10.7.89.115"; inherit custom inputs; })
./home-manager/headless.nix
[
./modules/docker
(import ./modules/restic-server-client {
inherit self username; time = "23:00";
inherit custom inputs; time = "23:00";
})
];
rss-bridge = mkComputer
(mkVM
{ hostname = "rss-bridge"; ip = "10.7.89.111"; inherit self; })
{ hostname = "rss-bridge"; ip = "10.7.89.111"; inherit custom inputs; })
./home-manager/headless.nix
[
./modules/docker
(import ./modules/restic-server-client {
inherit self username; time = "23:30";
inherit custom inputs; time = "23:30";
})
];
git = mkComputer
(mkVM
{ hostname = "git"; ip = "10.7.89.109"; inherit self; })
{ hostname = "git"; ip = "10.7.89.109"; inherit custom inputs; })
./home-manager/headless.nix
[
./modules/docker
(import ./modules/restic-server-client {
inherit self username; time = "03:00";
inherit custom inputs; time = "03:00";
})
];
plex = mkComputer
(mkVM
{ hostname = "plex"; ip = "10.7.89.112"; inherit self; })
{ hostname = "plex"; ip = "10.7.89.112"; inherit custom inputs; })
./home-manager/headless.nix
[
./modules/docker
./modules/media-share
./modules/plex
(import ./modules/restic-server-client {
inherit self username; time = "03:30";
inherit custom inputs; time = "03:30";
})
];
nextcloud = mkComputer
(mkVM
{ hostname = "nextcloud"; ip = "10.7.89.103"; inherit self; })
{ hostname = "nextcloud"; ip = "10.7.89.103"; inherit custom inputs; })
./home-manager/headless.nix
[
./modules/docker
(import ./modules/restic-server-client {
inherit self username; time = "04:00";
inherit custom inputs; time = "04:00";
})
];
mail = mkComputer
(mkVM
{ hostname = "mail"; ip = "10.7.89.123"; inherit self; })
{ hostname = "mail"; ip = "10.7.89.123"; inherit custom inputs; })
./home-manager/headless.nix
[
./modules/docker
(import ./modules/restic-server-client {
inherit self username; time = "04:30";
inherit custom inputs; time = "04:30";
})
];
pihole = mkComputer
(mkVM
{ hostname = "pihole"; ip = "10.7.89.2"; inherit self; })
{ hostname = "pihole"; ip = "10.7.89.2"; inherit custom inputs; })
./home-manager/headless.nix
[
./modules/docker
./modules/pihole
(import ./modules/restic-server-client {
inherit self username; time = "05:00";
inherit custom inputs; time = "05:00";
})
./modules/unbound
];
restic-server = mkComputer
(mkVM
{ hostname = "restic-server"; ip = "10.7.89.30"; inherit self; })
{ hostname = "restic-server"; ip = "10.7.89.30"; inherit custom inputs; })
./home-manager/headless.nix
[
./modules/restic-server
];
};
homeConfigurations = {
"${username}@co-ws-con4" = home-manager.lib.homeManagerConfiguration {
"${custom.username}@co-ws-con4" = home-manager.lib.homeManagerConfiguration {
configuration = import ./home-manager/work-wsl.nix;
inherit system username;
homeDirectory = "/home/${username}";
inherit inputs;
homeDirectory = "/home/${custom.username}";
extraSpecialArgs = {
inherit self system username;
inherit custom inputs;
};
};
};

View File

@ -1,8 +1,8 @@
{ username, ... }:
{ inputs, custom, ... }:
{
# Home Manager needs a bit of information about you and the
# paths it should manage.
home.username = username;
home.homeDirectory = "/home/${username}";
home.username = custom.username;
home.homeDirectory = "/home/${custom.username}";
programs.home-manager.enable = true;
}

View File

@ -187,7 +187,7 @@ mouse = [
start=lazy.window.get_position()),
Drag([mod], "Button3", lazy.window.set_size_floating(),
start=lazy.window.get_size()),
Click([mod], "Button2", lazy.window.bring_to_front())
Click([mod], "Button2", lazy.window.toggle_floating())
]
dgroups_key_binder = None

View File

@ -1,9 +1,10 @@
{ pkgs, username, ... }:
{ inputs, custom, pkgs, ... }:
{
imports = [
(import ./common { inherit username; })
(import ./common { inherit custom inputs; })
./software/work-desktop
./software/autorandr
./software/calibre
./software/czkawka
./software/dunst
./software/evince
@ -21,7 +22,6 @@
];
home.packages = with pkgs; [
arc-theme
calibre
digikam
firefox
gimp

View File

@ -1,7 +1,7 @@
{ pkgs, username, ... }:
{ inputs, custom, pkgs, ... }:
{
imports = [
(import ./common { inherit username; })
(import ./common { inherit custom inputs; })
./software/git
./software/vim
];

View File

@ -0,0 +1,17 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
calibre
];
xdg.mimeApps = {
enable = true;
associations.removed = {
"application/pdf" = "calibre-ebook-viewer.desktop";
"application/text" = "calibre-ebook-viewer.desktop";
"application/textedit" = "calibre-ebook-viewer.desktop";
"text/anytext" = "calibre-ebook-viewer.desktop";
"text/plain" = "calibre-ebook-viewer.desktop";
};
};
}

View File

@ -1,4 +1,4 @@
{ pkgs, username, ... }:
{ pkgs, ... }:
{
home.packages = with pkgs; [
vagrant

View File

@ -1,4 +1,4 @@
{ self, pkgs, username, ... }:
{ inputs, custom, pkgs, ... }:
{
imports = [
./common
@ -14,7 +14,7 @@
enable = true;
bashrcExtra = ''
. ~/.nixos/home-manager/configs/bash/work_wsl_bashrc
. /home/${username}/.nix-profile/etc/profile.d/nix.sh
. /home/${custom.username}/.nix-profile/etc/profile.d/nix.sh
'';
};
}

View File

@ -1,8 +1,8 @@
{ pkgs, username, ... }:
{ inputs, custom, pkgs, ... }:
{
services.code-server = {
enable = true;
user = username;
user = custom.username;
host = "0.0.0.0";
auth = "none";
extraPackages = with pkgs;
@ -14,7 +14,7 @@
git
];
extraEnvironment = {
HOME = "/home/${username}";
HOME = "/home/${custom.username}";
};
};
networking.firewall.allowedTCPPorts = [ 4444 ];

View File

@ -1,7 +1,7 @@
{ self, nixpkgs, pkgs, username, ... }:
{ inputs, custom, pkgs, ... }:
{
imports = [
"${self}/modules/cli"
"${inputs.self}/modules/cli"
];
# Use the systemd-boot EFI boot loader.
@ -49,7 +49,7 @@
# Disable the root user
users.users.root.hashedPassword = "!";
# Define a user account. Don't forget to set a password with passwd.
users.users.${username} = {
users.users.${custom.username} = {
isNormalUser = true;
initialPassword = "password";
extraGroups = [
@ -60,6 +60,8 @@
"ssh-rsa AAAAB3NzaC1y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uZ00QXudUosu5w5mJ+mRYlBZw6nrLOIZjgXbfMOsRtZFWVHWr011DO/ROXYQrG5xCG8wVJgE08R4njPlwb9EiYJD9CATttX3ryejhzYEloLg+ucbfcvs85hyyuCryIB7bIyCPim4ys6/GaTr2O2jAUXsE3Vvdiybg0UAuV0t94OQvtyHAs+yvIawt4LV7WBPYFkNuZ1ahG23hZb2IcU2YX9XvAQc2NOMEDJy76WBoXHlFa4LUaRFeVkv71xvRnWBlE2zSTiA/G+1qqkD7SN6I/MV4fMxF2mpbsfoGODhqrrmpvLNQoqxgWS1kvA4g94zLFXU+8I2Oy/kRIi9rGIDESHpuImdjXfYdpRfLyLRcDhxK2BIawerDJJ4iTFRHOSXWRlEiLdWDm2WFpRQWKkJ/lMu16n78hJfc1Ga/s/70yJi2GOcQN/nvETjrNG82gyxohNAOoMMkZP2AeC0mrPRi3dEqzc4ZUq4lcPAS/WjpQC9qNDxhQJXHmreSHG+qdEJaSQLlzFEwtVPYTFh8C/l/goVI3/moRlG3Cv+FQjAulVx/xck680PHN/GQ== flunder@blink"
];
};
@ -67,13 +69,10 @@
nixpkgs.config.allowUnfree = true;
nix = {
nixPath = [ "nixpkgs=${nixpkgs}" ];
registry.nixpkgs = {
from = {
id = "nixpkgs";
type = "indirect";
};
flake = nixpkgs;
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
registry = {
nixpkgs.flake = inputs.nixpkgs;
nix-config.flake = inputs.self;
};
autoOptimiseStore = true;
@ -121,7 +120,7 @@
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = import "${self}/version.nix";
system.stateVersion = import "${inputs.self}/version.nix";
}

View File

@ -1,4 +1,4 @@
{ pkgs, username, ... }:
{ inputs, custom, pkgs, ... }:
{
networking = {
networkmanager.enable = true;
@ -59,7 +59,7 @@
terminator
];
environment.shellAliases = {
management-server = "mosh ${username}@10.7.89.150 tmux a";
management-server = "mosh ${custom.username}@10.7.89.150 tmux a";
};
}

View File

@ -1,11 +1,11 @@
{ pkgs, username, ... }:
{ inputs, custom, pkgs, ... }:
{
virtualisation.docker =
{
enable = true;
autoPrune.enable = true;
};
users.users.${username}.extraGroups = [ "docker" ];
users.users.${custom.username}.extraGroups = [ "docker" ];
environment.systemPackages = with pkgs; [
docker-compose
lazydocker

View File

@ -1,4 +1,4 @@
{ pkgs, username, ... }:
{ inputs, custom, pkgs, ... }:
{
programs.droidcam.enable = true;
# required for USB connection
@ -6,7 +6,7 @@
environment.shellAliases = {
webcam = "droidcam-cli -size=1920x1080 ios 4747";
};
home-manager.users.${username} = {
home-manager.users.${custom.username} = {
xdg.desktopEntries = {
droidcam = {
name = "Droidcam";

View File

@ -1,10 +1,10 @@
{ pkgs, username, ... }:
{ inputs, custom, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
gnome.eog
];
home-manager.users.${username} = {
home-manager.users.${custom.username} = {
xdg.mimeApps = {
enable = true;
associations.added = {

View File

@ -1,7 +1,7 @@
{ pkgs, username, ... }:
{ inputs, custom, pkgs, ... }:
{
services.espanso.enable = true;
home-manager.users.${username} = {
home-manager.users.${custom.username} = {
xdg.configFile.espanso = {
target = "espanso/default.yml";
onChange = "systemctl --user restart espanso";

View File

@ -1,11 +1,11 @@
{ pkgs, username, ... }:
{ inputs, custom, pkgs, ... }:
{
nix.extraOptions = ''
keep-outputs = true
keep-derivations = true
'';
home-manager.users.${username} = {
home-manager.users.${custom.username} = {
programs.direnv.enable = true;
programs.direnv.nix-direnv.enable = true;
programs.direnv.nix-direnv.enableFlakes = true;

View File

@ -1,13 +1,13 @@
{ self, time, username, ... }:
{ inputs, custom, time, ... }:
{
services.restic.backups.${username} = {
services.restic.backups.${custom.username} = {
user = "root";
repository = "rest:http://10.7.89.30:8000";
timerConfig.OnCalendar = time;
passwordFile = "/home/${username}/.nixos/secrets/passwords/restic.key";
paths = [ "/home/${username}/" ];
passwordFile = "/home/${custom.username}/.nixos/secrets/passwords/restic.key";
paths = [ "/home/${custom.username}/" ];
extraBackupArgs = [
"--exclude-file=${self}/modules/restic/excludes.txt"
"--exclude-file=${inputs.self}/modules/restic/excludes.txt"
];
pruneOpts = [
"--keep-hourly 24"

View File

@ -1,4 +1,4 @@
{ pkgs, username, ... }:
{ inputs, custom, pkgs, ... }:
let
repository = "/mnt/restic-server";
in

View File

@ -1,20 +1,20 @@
{ self, pkgs, username, ... }:
{ inputs, custom, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
restic
];
services.restic.backups.${username} = {
user = username;
services.restic.backups.${custom.username} = {
user = custom.username;
repository = "rest:http://10.7.89.30:8000";
timerConfig = {
OnCalendar = "hourly";
RandomizedDelaySec = "15min";
};
passwordFile = "/home/${username}/.nixos/secrets/passwords/restic.key";
paths = [ "/home/${username}/" ];
passwordFile = "/home/${custom.username}/.nixos/secrets/passwords/restic.key";
paths = [ "/home/${custom.username}/" ];
extraBackupArgs = [
"--exclude-file=${self}/modules/restic/excludes.txt"
"--exclude-file=${inputs.self}/modules/restic/excludes.txt"
];
};
}

View File

@ -1,4 +1,4 @@
{ username, ... }:
{ inputs, custom, ... }:
{
programs.steam.enable = true;
hardware.steam-hardware.enable = true;
@ -6,7 +6,7 @@
allowedTCPPorts = [ 27036 ];
allowedUDPPorts = [ 27031 ];
};
home-manager.users.${username} = {
home-manager.users.${custom.username} = {
home.file.".local/share/applications/steam.desktop".source = ./steam.desktop;
};
}

View File

@ -1,8 +1,8 @@
{ self, hostname, ip, ... }:
{ inputs, custom, hostname, ip, ... }:
{
imports = [
(import "${self}/modules/mk-network" { inherit hostname ip; })
(import "${self}/systems/minimal")
(import "${inputs.self}/modules/mk-network" { inherit hostname ip; })
(import "${inputs.self}/systems/minimal")
];
boot.initrd.availableKernelModules = [
"ata_piix"