improvements

This commit is contained in:
Lukas Wurzinger 2024-03-08 22:46:46 +01:00
parent 48dcdc5a44
commit 9dffcd14b7
32 changed files with 640 additions and 623 deletions

View file

@ -1,6 +1,6 @@
# ✨ puter ✨ # ❄️ puter
This is my NixOS configuration. There are many like it, but this one is mine. This is my NixOS configuration. There are many like it, but this one is mine. Copy at your own risk.
## Partitioning ## Partitioning

View file

@ -0,0 +1,3 @@
{pkgs, ...}: {
environment.systemPackages = [pkgs.wl-clipboard];
}

View file

@ -1,8 +1,8 @@
{ {
imports = [ imports = [
./clipboard.nix
./compatibility.nix ./compatibility.nix
./docker.nix ./docker.nix
./fish.nix
./flatpak.nix ./flatpak.nix
./fonts.nix ./fonts.nix
./fs.nix ./fs.nix
@ -11,11 +11,12 @@
./hardware.nix ./hardware.nix
./location.nix ./location.nix
./mullvad.nix ./mullvad.nix
./neovide.nix
./networking.nix ./networking.nix
./pipewire.nix ./pipewire.nix
./plasma.nix ./plasma.nix
./printing.nix ./printing.nix
./syncthing.nix ./syncthing.nix
./vscode.nix ./users.nix
]; ];
} }

View file

@ -1,4 +0,0 @@
{pkgs, ...}: {
programs.fish.enable = true;
users.defaultUserShell = pkgs.fish;
}

View file

@ -1,25 +1,27 @@
{pkgs, ...}: { {pkgs, ...}: {
fonts = { fonts = {
enableDefaultPackages = true; enableDefaultPackages = true;
packages = [
packages = with pkgs; [ pkgs.noto-fonts
noto-fonts pkgs.noto-fonts-extra
noto-fonts-extra pkgs.noto-fonts-cjk-sans
noto-fonts-cjk-sans pkgs.noto-fonts-cjk-serif
noto-fonts-cjk-serif pkgs.noto-fonts-monochrome-emoji
noto-fonts-emoji pkgs.noto-fonts-color-emoji
(nerdfonts.override {fonts = ["Noto" "Iosevka"];}) (pkgs.nerdfonts.override {fonts = ["Noto"];})
]; ];
fontconfig = { fontconfig = {
enable = true; enable = true;
defaultFonts = { defaultFonts = {
monospace = ["NotoSansMono Nerd Font"]; monospace = ["NotoSansM Nerd Font"];
sansSerif = ["Noto Sans"]; sansSerif = ["Noto Sans"];
serif = ["Noto Serif"]; serif = ["Noto Serif"];
emoji = ["Noto Color Emoji"]; emoji = ["Noto Color Emoji" "Noto Emoji"];
}; };
}; };
fontDir.enable = true;
}; };
} }

View file

@ -0,0 +1,5 @@
{pkgs, ...}: let
package = pkgs.neovide;
in {
environment.systemPackages = [package];
}

View file

@ -1,28 +1,17 @@
{pkgs, ...}: { {pkgs, ...}: {
# TODO services.xserver = {
# displayManager = {
# defaultSession = "plasmawayland";
# sddm = {
# enable = true;
# autoNumlock = true;
# settings = {
# Theme = {
# CursorTheme = "breeze_cursors";
# };
# };
# };
# };
services = {
xserver = {
enable = true; enable = true;
desktopManager.plasma6.enable = true; desktopManager.plasma6.enable = true;
displayManager.sddm.enable = true; displayManager = {
excludePackages = with pkgs; [ defaultSession = "plasma";
xterm sddm = {
]; enable = true;
wayland.enable = true;
settings.Theme.CursorTheme = "breeze_cursors";
}; };
}; };
excludePackages = [pkgs.xterm];
};
environment = { environment = {
systemPackages = [ systemPackages = [
@ -31,11 +20,11 @@
pkgs.sddm-kcm pkgs.sddm-kcm
]; ];
sessionVariables = { sessionVariables = {
"SUDO_ASKPASS" = pkgs.writeShellScript "kdialogaskpass" '' SUDO_ASKPASS = pkgs.writeShellScript "kdialogaskpass" ''
exec ${pkgs.kdialog} --password Askpass exec ${pkgs.kdialog} --password Askpass
''; '';
"MOZ_USE_XINPUT2" = "1"; MOZ_USE_XINPUT2 = "1";
"GDK_SCALE" = "1"; GDK_SCALE = "1";
}; };
}; };

11
class/desktop/users.nix Normal file
View file

@ -0,0 +1,11 @@
{
users = {
groups.guest = {};
users.guest = {
isNormalUser = true;
password = "guest";
extraGroups = ["wheel" "networkmanager" "gamemode"];
};
};
}

View file

@ -1,3 +0,0 @@
{pkgs, ...}: {
environment.systemPackages = [pkgs.vscode-fhs];
}

View file

@ -1,5 +1,13 @@
{ {
services.atuin = { lib,
enable = true; pkgs,
}; ...
}: let
package = pkgs.atuin;
in {
environment.systemPackages = [package];
programs.bash.interactiveShellInit = ''
eval "$(${lib.getExe package} init bash)"
'';
} }

18
common/bash.nix Normal file
View file

@ -0,0 +1,18 @@
{
programs = {
command-not-found.enable = false;
bash = {
blesh.enable = true;
interactiveShellInit = ''
shopt -s globstar
shopt -s nullglob
shopt -s extglob
shopt -s checkwinsize
bind 'set show-mode-in-prompt off'
'';
};
};
}

3
common/bottom.nix Normal file
View file

@ -0,0 +1,3 @@
{pkgs, ...}: {
environment.systemPackages = [pkgs.bottom];
}

View file

@ -1,59 +0,0 @@
{
config,
lib,
pkgs,
...
}: {
programs = {
command-not-found.enable = false;
git = {
enable = true;
lfs.enable = true;
};
nix-index = {
enable = true;
enableBashIntegration = true;
};
direnv.enable = true;
bash = {
promptInit = ''
if [[ -v SSH_CLIENT && -v SSH_CONNECTION && -v SSH_TTY ]]; then
PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='\[\033[01;34m\]\w\[\033[00m\]\$ '
fi
'';
interactiveShellInit = ''
shopt -s histappend
HISTCONTROL='ignoredups:ignorespace'
HISTSIZE=1000
HISTFILESIZE=10000
shopt -s globstar
shopt -s nullglob
shopt -s extglob
shopt -s checkwinsize
eval "$(${lib.getExe config.programs.direnv.package} hook bash)"
'';
};
};
environment = {
systemPackages = [
pkgs.bottom
pkgs.comma
pkgs.helix
];
variables = {
EDITOR = lib.getExe pkgs.helix;
VISUAL = lib.getExe pkgs.helix;
};
};
}

View file

@ -2,11 +2,15 @@
imports = [ imports = [
./atuin.nix ./atuin.nix
./avahi.nix ./avahi.nix
./bash.nix
./boot.nix ./boot.nix
./cli.nix ./bottom.nix
./dbus.nix ./dbus.nix
./direnv.nix
./fs.nix ./fs.nix
./fwupd.nix ./fwupd.nix
./git.nix
./myvim.nix
./nix.nix ./nix.nix
./opengl.nix ./opengl.nix
./readline.nix ./readline.nix

11
common/direnv.nix Normal file
View file

@ -0,0 +1,11 @@
{
config,
lib,
...
}: {
programs.direnv.enable = true;
programs.bash.interactiveShellInit = ''
eval "$(${lib.getExe config.programs.direnv.package} hook bash)"
'';
}

6
common/git.nix Normal file
View file

@ -0,0 +1,6 @@
{
programs.git = {
enable = true;
lfs.enable = true;
};
}

18
common/myvim.nix Normal file
View file

@ -0,0 +1,18 @@
{
lib,
inputs,
pkgs,
...
}: {
environment = let
package = inputs.myvim.packages.${pkgs.system}.default;
in {
systemPackages = [package];
variables = let
name = builtins.baseNameOf (lib.getExe package);
in {
EDITOR = name;
VISUAL = name;
};
};
}

View file

@ -10,6 +10,7 @@
nixPath = lib.mapAttrsToList (key: _: "${key}=flake:${key}") config.nix.registry; nixPath = lib.mapAttrsToList (key: _: "${key}=flake:${key}") config.nix.registry;
settings = { settings = {
trusted-users = ["@wheel"];
experimental-features = "nix-command flakes"; experimental-features = "nix-command flakes";
auto-optimise-store = true; auto-optimise-store = true;
}; };

View file

@ -2,8 +2,6 @@
programs.starship = { programs.starship = {
enable = true; enable = true;
interactiveOnly = true; interactiveOnly = true;
settings = { settings.format = "$all";
format = "$all";
};
}; };
} }

View file

@ -3,6 +3,9 @@
users = { users = {
mutableUsers = false; mutableUsers = false;
groups.lukas = {};
users = { users = {
root.hashedPassword = "!"; root.hashedPassword = "!";
lukas = { lukas = {

3
common/zellij.nix Normal file
View file

@ -0,0 +1,3 @@
{pkgs, ...}: {
environment.systemPackages = [pkgs.zellij];
}

View file

@ -59,6 +59,29 @@
"type": "github" "type": "github"
} }
}, },
"devshell": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"myvim",
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1708939976,
"narHash": "sha256-O5+nFozxz2Vubpdl1YZtPrilcIXPcRAjqNdNE8oCRoA=",
"owner": "numtide",
"repo": "devshell",
"rev": "5ddecd67edbd568ebe0a55905273e56cc82aabe3",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"flake-compat": { "flake-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -75,13 +98,160 @@
"type": "github" "type": "github"
} }
}, },
"flake-compat_2": {
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"revCount": 57,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
}
},
"flake-compat_3": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1709336216,
"narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib_2"
},
"locked": {
"lastModified": 1709336216,
"narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_3": {
"inputs": {
"nixpkgs-lib": [
"myvim",
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709336216,
"narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_3"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"myvim",
"nixvim",
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1703887061,
"narHash": "sha256-gGPa9qWNc6eCXT/+Z5/zMkyYOuRZqeFZBDbopNZQkuY=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "43e1aa1308018f37118e34d3a9cb4f5e75dc11d5",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"hardware": { "hardware": {
"locked": { "locked": {
"lastModified": 1708594753, "lastModified": 1709410583,
"narHash": "sha256-c/gH7iXS/IYH9NrFOT+aJqTq+iEBkvAkpWuUHGU3+f0=", "narHash": "sha256-esOSUoQ7mblwcsSea0K17McZuwAIjoS6dq/4b83+lvw=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "3f7d0bca003eac1a1a7f4659bbab9c8f8c2a0958", "rev": "59e37017b9ed31dee303dbbd4531c594df95cfbc",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -111,6 +281,28 @@
"type": "github" "type": "github"
} }
}, },
"home-manager_2": {
"inputs": {
"nixpkgs": [
"myvim",
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709578243,
"narHash": "sha256-hF96D+c2PBmAFhymMw3z8hou++lqKtZ7IzpFbYeL1/Y=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "23ff9821bcaec12981e32049e8687f25f11e5ef3",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"impermanence": { "impermanence": {
"locked": { "locked": {
"lastModified": 1708968331, "lastModified": 1708968331,
@ -136,11 +328,11 @@
"utils": "utils" "utils": "utils"
}, },
"locked": { "locked": {
"lastModified": 1706742486, "lastModified": 1709905972,
"narHash": "sha256-sv/MISTeD0rqeVivpZJpynboMWJp6i62OmrZX1rGl38=", "narHash": "sha256-18OF2/ypr0n4Lp6Fk5SLHPu12ok6jM+Hv3sC0PCim0Q=",
"owner": "simple-nixos-mailserver", "owner": "simple-nixos-mailserver",
"repo": "nixos-mailserver", "repo": "nixos-mailserver",
"rev": "9e36323ae3dde787f761420465c3ae560f3dbf29", "rev": "572c1b4d69deea1093ac231c37927cfa8ccad477",
"type": "gitlab" "type": "gitlab"
}, },
"original": { "original": {
@ -149,6 +341,48 @@
"type": "gitlab" "type": "gitlab"
} }
}, },
"myvim": {
"inputs": {
"flake-parts": "flake-parts_2",
"nixpkgs": "nixpkgs_3",
"nixvim": "nixvim"
},
"locked": {
"lastModified": 1709934012,
"narHash": "sha256-BLyDTCDzqsKQchfpsMiYn37LIxGSuO0Xt20pNByfQpo=",
"owner": "lukaswrz",
"repo": "myvim",
"rev": "badba27c9f9052e73074801af36e099462c38da9",
"type": "github"
},
"original": {
"owner": "lukaswrz",
"repo": "myvim",
"type": "github"
}
},
"nix-darwin": {
"inputs": {
"nixpkgs": [
"myvim",
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709554374,
"narHash": "sha256-1yYgwxBzia+QrOaQaZ6YKqGFfiQcSBwYLzd9XRsRLQY=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "daa03606dfb5296a22e842acb02b46c1c4e9f5e7",
"type": "github"
},
"original": {
"owner": "lnl7",
"repo": "nix-darwin",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1703013332, "lastModified": 1703013332,
@ -195,6 +429,42 @@
"type": "indirect" "type": "indirect"
} }
}, },
"nixpkgs-lib": {
"locked": {
"dir": "lib",
"lastModified": 1709237383,
"narHash": "sha256-cy6ArO4k5qTx+l5o+0mL9f5fa86tYUX3ozE1S+Txlds=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1536926ef5621b09bba54035ae2bb6d806d72ac8",
"type": "github"
},
"original": {
"dir": "lib",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib_2": {
"locked": {
"dir": "lib",
"lastModified": 1709237383,
"narHash": "sha256-cy6ArO4k5qTx+l5o+0mL9f5fa86tYUX3ozE1S+Txlds=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1536926ef5621b09bba54035ae2bb6d806d72ac8",
"type": "github"
},
"original": {
"dir": "lib",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1705856552, "lastModified": 1705856552,
@ -212,27 +482,115 @@
}, },
"nixpkgs_3": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1709018681, "lastModified": 1709703039,
"narHash": "sha256-nJXhGOM5Sk1TjtGQjP1qfrq/dNyCakAjHINUF76VBhA=", "narHash": "sha256-6hqgQ8OK6gsMu1VtcGKBxKQInRLHtzulDo9Z5jxHEFY=",
"owner": "K900", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "d4a80ff23f9a4465a01a1aab462338e6837ea9be", "rev": "9df3e30ce24fd28c7b3e2de0d986769db5d6225d",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "K900", "owner": "NixOS",
"ref": "plasma-6", "ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"nixpkgs_4": {
"locked": {
"lastModified": 1709479366,
"narHash": "sha256-n6F0n8UV6lnTZbYPl1A9q1BS0p4hduAv1mGAP17CVd0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b8697e57f10292a6165a20f03d2f42920dfaf973",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_5": {
"locked": {
"lastModified": 1709703039,
"narHash": "sha256-6hqgQ8OK6gsMu1VtcGKBxKQInRLHtzulDo9Z5jxHEFY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9df3e30ce24fd28c7b3e2de0d986769db5d6225d",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixvim": {
"inputs": {
"devshell": "devshell",
"flake-compat": "flake-compat_2",
"flake-parts": "flake-parts_3",
"home-manager": "home-manager_2",
"nix-darwin": "nix-darwin",
"nixpkgs": "nixpkgs_4",
"pre-commit-hooks": "pre-commit-hooks"
},
"locked": {
"lastModified": 1709928810,
"narHash": "sha256-K9TwzOtmOTC0a1FNRfph2WLlMlEx5O38Rg5kXJ5hNxg=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "f6e79601adab90a922fd60009af9670ef1f035fa",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixvim",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat_3",
"flake-utils": "flake-utils_2",
"gitignore": "gitignore",
"nixpkgs": [
"myvim",
"nixvim",
"nixpkgs"
],
"nixpkgs-stable": [
"myvim",
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1708018599,
"narHash": "sha256-M+Ng6+SePmA8g06CmUZWi1AjG2tFBX9WCXElBHEKnyM=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "5df5a70ad7575f6601d91f0efec95dd9bc619431",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"agenix": "agenix", "agenix": "agenix",
"flake-parts": "flake-parts",
"hardware": "hardware", "hardware": "hardware",
"impermanence": "impermanence", "impermanence": "impermanence",
"mailserver": "mailserver", "mailserver": "mailserver",
"nixpkgs": "nixpkgs_3" "myvim": "myvim",
"nixpkgs": "nixpkgs_5"
} }
}, },
"systems": { "systems": {
@ -250,6 +608,36 @@
"type": "github" "type": "github"
} }
}, },
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": { "utils": {
"locked": { "locked": {
"lastModified": 1605370193, "lastModified": 1605370193,

View file

@ -2,20 +2,25 @@
description = "My NixOS configuration"; description = "My NixOS configuration";
inputs = { inputs = {
nixpkgs.url = "github:K900/nixpkgs/plasma-6"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
hardware.url = "github:NixOS/nixos-hardware"; hardware.url = "github:NixOS/nixos-hardware";
impermanence.url = "github:nix-community/impermanence"; impermanence.url = "github:nix-community/impermanence";
agenix.url = "github:ryantm/agenix"; agenix.url = "github:ryantm/agenix";
mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver"; mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver";
myvim.url = "github:lukaswrz/myvim";
}; };
outputs = {nixpkgs, ...} @ inputs: let outputs = {
supportedSystems = ["x86_64-linux" "aarch64-linux"]; nixpkgs,
flake-parts,
...
} @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = ["x86_64-linux" "aarch64-linux"];
forEachSystem = f: flake = let
nixpkgs.lib.genAttrs supportedSystems (system: f (import nixpkgs {inherit system;})); commonNixosSystem = name: class:
mkSystem = name: class:
nixpkgs.lib.nixosSystem { nixpkgs.lib.nixosSystem {
specialArgs = { specialArgs = {
inherit inputs; inherit inputs;
@ -27,40 +32,32 @@
inputs.mailserver.nixosModule inputs.mailserver.nixosModule
./common ./common
(./class + "/${class}") ./class/${class}
(./hosts + "/${name}") ./hosts/${name}
({lib, ...}: {networking.hostName = lib.mkDefault name;}) ({lib, ...}: {networking.hostName = lib.mkDefault name;})
]; ];
}; };
in {
hosts = { nixosConfigurations = builtins.mapAttrs commonNixosSystem {
glacier = "desktop"; glacier = "desktop";
flamingo = "desktop"; flamingo = "desktop";
scenery = "desktop"; scenery = "desktop";
abacus = "server"; abacus = "server";
vessel = "server"; vessel = "server";
}; };
in {
nixosConfigurations = builtins.mapAttrs mkSystem hosts;
devShells = forEachSystem (pkgs: {
default = pkgs.mkShellNoCC {
packages = [
pkgs.nil
inputs.agenix.packages.${pkgs.system}.agenix
(pkgs.writeShellApplication {
name = "home";
runtimeInputs = [
pkgs.git
pkgs.flatpak
];
text = builtins.readFile ./scripts/home.sh;
})
];
}; };
});
formatter = forEachSystem (pkgs: pkgs.alejandra); perSystem = {
inputs',
pkgs,
...
}: {
devShells.default = pkgs.mkShellNoCC {
packages = [inputs'.agenix.packages.agenix];
};
formatter = pkgs.alejandra;
};
}; };
} }

View file

@ -1,42 +0,0 @@
source /etc/bashrc
if [[ $- != *i* ]]; then
return
fi
alias cpr='cp --recursive'
alias df='df --human-readable'
alias du='du --human-readable'
alias gia='git add'
alias gic='git commit'
alias gico='git checkout'
alias gid='git diff'
alias gidh='git diff HEAD'
alias gi='git'
alias gin='grep --ignore-case --line-number'
alias gis='git status'
alias g='grep'
alias gn='grep --line-number'
alias grep='grep --color'
alias grin='grep --recursive --ignore-case --line-number'
alias la='ls --all'
alias lla='ls -l --all'
alias ll='ls -l'
alias l='ls'
alias lsa='ls --all'
alias lsla='ls -l --all'
alias lsl='ls -l'
alias ls='ls --color --classify'
alias rmr='rm --recursive'
alias rr='rm --recursive'
alias s='sudo'
alias ffmpeg='ffmpeg -hide_banner'
alias ffprobe='ffprobe -hide_banner'

View file

@ -1,147 +0,0 @@
if status is-interactive
stty -ixon
set fish_greeting
fish_vi_key_bindings
bind \ee edit_command_buffer
set fish_cursor_default block blink
set fish_cursor_insert line blink
set fish_cursor_replace_one underscore blink
set fish_cursor_visual block
abbr --add --global l ls
abbr --add --global lsa ls -a
abbr --add --global la ls -a
abbr --add --global lsl ls -l
abbr --add --global ll ls -l
abbr --add --global lsla ls -la
abbr --add --global lla ls -la
abbr --add --global cp cp -n
abbr --add --global cpr cp -rn
abbr --add --global mv mv -n
abbr --add --global rm rm -i
abbr --add --global rmr rm -ri
abbr --add --global rr rm -ri
abbr --add --global v hx
abbr --add --global g git
abbr --add --global gc git commit
abbr --add --global gco git checkout
abbr --add --global gs git status
abbr --add --global gd git diff
abbr --add --global gdh git diff HEAD
abbr --add --global ga git add
abbr --add --global s sudo
abbr --add --global g grep
abbr --add --global gn grep -n
abbr --add --global gin grep -in
abbr --add --global grin grep -rin
abbr --add --global df df -h
abbr --add --global du du -h
abbr --add --global c cd
abbr --add --global cd. cd .
abbr --add --global cd.. cd ..
function ls; command ls --classify=auto --color=auto $argv; end
function ffmpeg; command ffmpeg -hide_banner $argv; end
function ffprobe; command ffprobe -hide_banner $argv; end
function ffplay; command ffplay -hide_banner $argv; end
function fish_prompt
if test $CMD_DURATION -gt 10000
echo -ne '\a'
end
set -l __last_command_exit_status $status
if not set -q -g __fish_arrow_functions_defined
set -g __fish_arrow_functions_defined
function _git_branch_name
set -l branch (git symbolic-ref --quiet HEAD 2>/dev/null)
if set -q branch[1]
echo (string replace -r '^refs/heads/' '' $branch)
else
echo (git rev-parse --short HEAD 2>/dev/null)
end
end
function _is_git_dirty
not command git diff-index --cached --quiet HEAD -- &>/dev/null
or not command git diff --no-ext-diff --quiet --exit-code &>/dev/null
end
function _is_git_repo
type -q git
or return 1
git rev-parse --git-dir >/dev/null 2>&1
end
function _hg_branch_name
echo (hg branch 2>/dev/null)
end
function _is_hg_dirty
set -l stat (hg status -mard 2>/dev/null)
test -n "$stat"
end
function _is_hg_repo
fish_print_hg_root >/dev/null
end
function _repo_branch_name
_$argv[1]_branch_name
end
function _is_repo_dirty
_is_$argv[1]_dirty
end
function _repo_type
if _is_hg_repo
echo hg
return 0
else if _is_git_repo
echo git
return 0
end
return 1
end
end
set -l cyan (set_color -o cyan)
set -l yellow (set_color -o yellow)
set -l red (set_color -o red)
set -l green (set_color -o green)
set -l blue (set_color -o blue)
set -l normal (set_color normal)
set -l prompt_color "$green"
if test $__last_command_exit_status != 0
set prompt_color "$red"
end
set -l prompt "$prompt_color\$"
if fish_is_root_user
set prompt "$prompt_color#"
end
set -l cwd $cyan(basename -- (prompt_pwd))
set -l repo_info
if set -l repo_type (_repo_type)
set -l repo_branch $red(_repo_branch_name $repo_type)
set repo_info "$blue $repo_type:($repo_branch$blue)"
if _is_repo_dirty $repo_type
set -l dirty "$yellow"
set repo_info "$repo_info$dirty"
end
end
echo -n -s -- $cwd $repo_info ' ' $prompt ' '$normal
end
direnv hook fish | source
end

View file

@ -1,24 +0,0 @@
theme = "logarithmancy"
[editor]
auto-save = true
bufferline = "multiple"
cursorline = true
line-number = "relative"
rulers = [80]
[editor.cursor-shape]
insert = "bar"
normal = "block"
select = "underline"
[editor.file-picker]
hidden = false
[editor.indent-guides]
render = true
[editor.lsp]
display-messages = true
[keys.normal]
esc = ["collapse_selection", "keep_primary_selection"]

View file

@ -1,5 +0,0 @@
inherits = "github_dark_high_contrast"
"ui.background" = "none"
["ui.virtual.indent-guide"]
fg = "#2d3640"

33
hosts/abacus/atuin.nix Normal file
View file

@ -0,0 +1,33 @@
{
config,
lib,
...
}: {
services = {
postgresql = {
enable = lib.mkDefault true;
ensureDatabases = ["atuin"];
ensureUsers = [
{
name = "atuin";
ensureDBOwnership = true;
}
];
};
atuin = {
enable = true;
openRegistration = false;
database.uri = "postgresql:///atuin?host=/run/postgresql&user=atuin";
};
nginx.virtualHosts."atuin.${config.networking.domain}" = {
enableACME = true;
forceSSL = true;
quic = true;
locations."/".proxyPass = "http://${config.services.atuin.host}:${builtins.toString config.services.atuin.port}";
};
};
}

View file

@ -2,6 +2,7 @@
imports = [ imports = [
(modulesPath + "/profiles/qemu-guest.nix") (modulesPath + "/profiles/qemu-guest.nix")
./atuin.nix
./conduit.nix ./conduit.nix
./forgejo.nix ./forgejo.nix
./mailserver.nix ./mailserver.nix

View file

@ -1,5 +1,4 @@
{ {
attrName,
inputs, inputs,
modulesPath, modulesPath,
... ...

View file

@ -7,17 +7,18 @@
}: let }: let
safePath = "/srv/storage/safe"; safePath = "/srv/storage/safe";
in { in {
systemd.timers.local-backup = { systemd = {
timers.local-backup = {
description = "Local rsync Backup"; description = "Local rsync Backup";
wantedBy = ["timers.target"]; wantedBy = ["timers.target"];
timerConfig = { timerConfig = {
OnCalendar = "*-*-* 00:00:00"; OnCalendar = "*-*-* 03:00:00";
Persistent = true; Persistent = true;
Unit = "local-backup.service"; Unit = "local-backup.service";
}; };
}; };
systemd.services.local-backup = { services.local-backup = {
description = "Local rsync Backup"; description = "Local rsync Backup";
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
@ -27,6 +28,15 @@ in {
}; };
}; };
tmpfiles.settings = {
"10-storage-safe".${safePath}.d = {
user = "root";
group = "root";
mode = "0755";
};
};
};
fileSystems."/srv/backup" = { fileSystems."/srv/backup" = {
device = "/dev/disk/by-label/backup"; device = "/dev/disk/by-label/backup";
fsType = "btrfs"; fsType = "btrfs";
@ -41,14 +51,10 @@ in {
paths = [safePath]; paths = [safePath];
passwordFile = config.age.secrets."restic-${attrName}".path; passwordFile = config.age.secrets."restic-${attrName}".path;
pruneOpts = ["--keep-daily 7" "--keep-weekly 5" "--keep-monthly 12"]; pruneOpts = ["--keep-daily 7" "--keep-weekly 5" "--keep-monthly 12"];
extraOptions = ["sftp.args='-i /etc/ssh/ssh_host_ed25519_key'"]; timerConfig = {
}; OnCalendar = "*-*-* 03:00:00";
Persistent = true;
systemd.tmpfiles.settings = {
"10-storage-safe".${safePath}.d = {
user = "root";
group = "root";
mode = "0755";
}; };
extraOptions = ["sftp.args='-i /etc/ssh/ssh_host_ed25519_key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'"];
}; };
} }

View file

@ -1,207 +0,0 @@
shopt -s nullglob
opts=$(getopt --options n:e: --longoptions=name:,email: --name "$0" -- "$@")
eval set -- "$opts"
name=
email=
while true; do
case "$1" in
-n | --name)
name=$2
shift 2
;;
-e | --email)
email=$2
shift 2
;;
--)
shift
break
;;
esac
done
choices=("$@")
shift "$#"
function chose() {
if [[ ${#choices[@]} == 0 ]]; then
return 0
fi
local arg
for arg in "$@"; do
local choice
for choice in "${choices[@]}"; do
if [[ "$arg" == "$choice" ]]; then
return 0
fi
done
done
return 1
}
if chose git; then
gitconfig=${XDG_CONFIG_HOME:-$HOME/.config}/git/config
if [[ -n $name ]]; then
GIT_CONFIG_GLOBAL=$gitconfig git config --global -- user.name "$name"
fi
if [[ -n $email ]]; then
GIT_CONFIG_GLOBAL=$gitconfig git config --global -- user.email "$email"
fi
gitignore=$(GIT_CONFIG_GLOBAL=$gitconfig git config --global --get core.excludesFile 2>/dev/null || printf '%s\n' "${XDG_CONFIG_HOME:-$HOME/.config}/git/ignore")
mkdir --parents -- "$(dirname -- "$gitignore")"
cat <<EOF >"$gitignore"
.idea/
.vscode/
.iml
*.sublime-workspace
node_modules/
vendor/
log/
*.log
__pycache__/
zig-cache/
*.com
*.class
*.dll
*.exe
*.o
*.so
*.pyc
*.pyo
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
*.msi
*.sqlite
*.sqlite3
*.db
*.db3
*.s3db
*.sl3
*.rdb
*.bak
*.swp
*.swo
*~
*#
zig-out/
.direnv/
EOF
GIT_CONFIG_GLOBAL=$gitconfig git config --global -- core.excludesFile "$gitignore"
fi
if chose mpv; then
if flatpak info io.mpv.Mpv >/dev/null 2>&1; then
mpvconf=$HOME/.var/app/io.mpv.Mpv/config/mpv/mpv.conf
mkdir --parents -- "$(dirname -- "$mpvconf")"
cat <<EOF >"$mpvconf"
force-window=immediate
keep-open=yes
save-position-on-quit=yes
screenshot-template="%f_%wH%wM%wS.%wT"
scale=ewa_lanczossharp
cscale=ewa_lanczossharp
tscale=oversample
interpolation=yes
video-sync=display-resample
vo=gpu
profile=gpu-hq
EOF
fi
fi
if chose firefox; then
if flatpak info org.mozilla.firefox >/dev/null 2>&1; then
ffparent=$HOME/.var/app/org.mozilla.firefox/.mozilla/firefox
for profile in "$ffparent"/*.default "$ffparent"/*.default-release; do
userjs=$profile/user.js
cat <<EOF >"$userjs"
// Forms
user_pref('signon.prefillForms', false);
user_pref('signon.rememberSignons', false);
user_pref('signon.autofillForms', false);
user_pref('signon.formlessCapture.enabled', false);
user_pref('browser.formfill.enable', false);
// Pocket
user_pref('extensions.pocket.enabled', false);
// Sponsorships
user_pref('browser.newtabpage.activity-stream.showSponsored', false);
user_pref('browser.newtabpage.activity-stream.showSponsoredTopSites', false);
user_pref('browser.newtabpage.activity-stream.feeds.section.topstories', false);
user_pref('browser.newtabpage.activity-stream.feeds.topsites', false);
user_pref('browser.newtabpage.activity-stream.section.highlights.includeBookmarks', false);
user_pref('browser.newtabpage.activity-stream.section.highlights.includeDownloads', false);
user_pref('browser.newtabpage.activity-stream.section.highlights.includeVisited', false);
// VA-API (https://bugzilla.mozilla.org/show_bug.cgi?id=1610199)
user_pref('media.ffmpeg.vaapi.enabled', true);
// Telemetry
user_pref('toolkit.telemetry.unified', false);
user_pref('toolkit.telemetry.enabled', false);
user_pref('toolkit.telemetry.server', 'data:,');
user_pref('toolkit.telemetry.archive.enabled', false);
user_pref('toolkit.telemetry.newProfilePing.enabled', false);
user_pref('toolkit.telemetry.shutdownPingSender.enabled', false);
user_pref('toolkit.telemetry.updatePing.enabled', false);
user_pref('toolkit.telemetry.bhrPing.enabled', false);
user_pref('toolkit.telemetry.firstShutdownPing.enabled', false);
user_pref('toolkit.telemetry.coverage.opt-out', true);
user_pref('toolkit.coverage.opt-out', true);
user_pref('toolkit.coverage.endpoint.base', '');
user_pref('browser.ping-centre.telemetry', false);
user_pref('app.shield.optoutstudies.enabled', false);
user_pref('app.normandy.enabled', false);
user_pref('app.normandy.api_url', '');
user_pref('breakpad.reportURL', '');
user_pref('browser.tabs.crashReporting.sendReport', false);
user_pref('browser.crashReports.unsubmittedCheck.autoSubmit2', false);
// Referer
user_pref("network.http.referer.XOriginPolicy", 1);
user_pref("network.http.referer.XOriginTrimmingPolicy", 0);
EOF
done
fi
fi
if chose bash; then
bashrc=$HOME/.bashrc
ln --force --symbolic -- "$PWD/home/bash/bashrc" "$bashrc"
fi
if chose fish; then
fishconfig=${XDG_CONFIG_HOME:-$HOME/.config}/fish/config.fish
mkdir --parents -- "$(dirname -- "$fishconfig")"
ln --force --symbolic -- "$PWD/home/fish/config.fish" "$fishconfig"
fi
if chose helix; then
helixdir=${XDG_CONFIG_HOME:-$HOME/.config}/helix
rm --recursive --force -- "$helixdir"
ln --force --symbolic -- "$PWD/home/helix" "$helixdir"
fi