Merge remote-tracking branch 'origin/nixos' into nixos

This commit is contained in:
Moritz Böhme 2023-05-14 15:32:50 +02:00
commit 420b5d5d10
Signed by: moritz
GPG key ID: 970C6E89EB0547A9
40 changed files with 341 additions and 281 deletions

View file

@ -980,8 +980,7 @@
"nvim-treesitter-textsubjects": "nvim-treesitter-textsubjects",
"pre-commit-hooks": "pre-commit-hooks",
"smartcolumn-nvim": "smartcolumn-nvim",
"stable": "stable",
"utils": "utils"
"stable": "stable"
}
},
"rust-overlay": {
@ -1083,26 +1082,6 @@
"type": "github"
}
},
"utils": {
"inputs": {
"flake-utils": [
"flake-utils"
]
},
"locked": {
"lastModified": 1657226504,
"narHash": "sha256-GIYNjuq4mJlFgqKsZ+YrgzWm0IpA4axA3MCrdKYj7gs=",
"owner": "gytis-ivaskevicius",
"repo": "flake-utils-plus",
"rev": "2bf0f91643c2e5ae38c1b26893ac2927ac9bd82a",
"type": "github"
},
"original": {
"owner": "gytis-ivaskevicius",
"repo": "flake-utils-plus",
"type": "github"
}
},
"wlroots": {
"flake": false,
"locked": {

182
flake.nix
View file

@ -13,8 +13,6 @@
stable.url = "github:nixos/nixpkgs/nixos-22.11";
flake-utils.url = "github:numtide/flake-utils";
utils.url = "github:gytis-ivaskevicius/flake-utils-plus";
utils.inputs.flake-utils.follows = "flake-utils";
agenix.inputs.nixpkgs.follows = "nixpkgs";
agenix.url = "github:ryantm/agenix";
@ -79,58 +77,51 @@
Outputs
*/
outputs =
inputs@{ self, nixpkgs, utils, ... }:
utils.lib.mkFlake {
inherit self inputs;
outputs = inputs@{ self, nixpkgs, ... }:
let
systems = [ "x86_64-linux" "aarch64-linux" ];
supportedSystems = [ "x86_64-linux" ];
channelsConfig.allowUnfree = true;
forEachSystem = lib.genAttrs systems;
lib = nixpkgs.lib.extend
(self: _: { my = import ./lib { lib = self; }; });
/*
Overlays
*/
overlay = import ./overlays {
inherit inputs;
inherit (self) lib;
};
channels.nixpkgs.overlaysBuilder = _: [
config.allowUnfree = true;
overlays = [
inputs.hypr-contrib.overlays.default
inputs.hyprland.overlays.default
inputs.neovim-nightly-overlay.overlay
inputs.utils.overlay
self.overlay
overlay
];
overlays = utils.lib.exportOverlays
{
inherit (self) pkgs inputs;
} // {
default = self.overlay;
pkgsFor = system: import nixpkgs {
inherit system config;
overlays = overlays ++ [
(
_: prev: {
master = import inputs.master {
inherit (prev) system;
inherit overlays config;
};
stable = import inputs.stable {
inherit (prev) system;
inherit overlays config;
};
}
)
overlay
];
};
/*
Modules
*/
nixosModules = utils.lib.exportModules [
./modules/profiles/base.nix
./modules/profiles/gaming.nix
./modules/profiles/desktop.nix
./modules/profiles/personal.nix
];
hostDefaults.modules = [
./modules/default.nix
self.nixosModules.base
defaultModules = [
{ nixpkgs = { inherit config; }; }
./modules
inputs.home-manager.nixosModule
{
home-manager = {
@ -142,50 +133,83 @@
inputs.agenix.nixosModules.age
];
hosts.nixos-laptop.modules = [
./hosts/nixos-laptop
self.nixosModules.desktop
self.nixosModules.personal
];
hosts.nixos-desktop.modules = [
./hosts/nixos-desktop
self.nixosModules.desktop
self.nixosModules.gaming
self.nixosModules.personal
];
/*
Other Outputs
*/
outputsBuilder = channels:
with channels.nixpkgs; {
devShells.default = mkShell {
inherit (self.checks.${system}.pre-commit-check) shellHook;
name = "dotfiles";
packages = [
# Secrets
pkgs.agenix
# cachix
cachix
];
};
checks.pre-commit-check = inputs.pre-commit-hooks.lib."${system}".run {
src = ./.;
hooks = {
nixpkgs-fmt.enable = true;
statix.enable = true;
shellcheck.enable = true;
stylua.enable = true;
hosts = self.lib.my.mapModules
(path:
let
system = import "${path}/system.nix";
pkgs = pkgsFor system;
in
lib.nixosSystem {
inherit pkgs system lib;
specialArgs = {
inherit inputs self;
};
};
modules = defaultModules ++ [ path ];
})
./hosts;
packages = utils.lib.exportPackages self.overlays channels;
pre-commit-check = system: inputs.pre-commit-hooks.lib."${system}".run {
src = ./.;
hooks = {
nixpkgs-fmt.enable = true;
statix.enable = true;
shellcheck.enable = true;
stylua.enable = true;
};
};
in
with lib; {
inherit lib;
# ╔══════════════════════════════════════════════════════════╗
# ║ NixOS Configurations ║
# ╚══════════════════════════════════════════════════════════╝
nixosConfigurations = hosts;
# ╔══════════════════════════════════════════════════════════╗
# ║ Other Outputs ║
# ╚══════════════════════════════════════════════════════════╝
devShells = forEachSystem (system:
let
pkgs = pkgsFor system;
in
{
default = pkgs.mkShell
{
inherit (pre-commit-check system) shellHook;
name = "dotfiles";
packages = with pkgs; [
# Secrets
agenix
# cachix
cachix
];
};
});
checks = forEachSystem (system: {
pre-commit-check = pre-commit-check system;
});
legacyPackages = forEachSystem pkgsFor;
packages = forEachSystem (system:
let
pkgs = pkgsFor system;
in
filterAttrs (_: isDerivation)
(overlay pkgs pkgs)
);
overlays =
let
overlayNames = attrNames (overlay null null);
mkOverlay = name: final: prev: (overlay final prev).${name};
in
(genAttrs overlayNames mkOverlay) // {
default = overlay;
};
};
}

View file

@ -10,7 +10,13 @@
# Include the results of the hardware scan.
./hardware-configuration.nix
];
my = {
profiles = {
desktop.enable = true;
gaming.enable = true;
personal.enable = true;
};
programs.hyprland.nvidiaSupport = true;
services.mullvad.enable = true;
programs.ledger.enable = true;

View file

@ -0,0 +1 @@
"x86_64-linux"

View file

@ -10,7 +10,13 @@
./hardware-configuration.nix
];
my.virtualisation.libvirtd.enable = true;
my = {
virtualisation.libvirtd.enable = true;
profiles = {
desktop.enable = true;
personal.enable = true;
};
};
# BOOT
boot = {
@ -31,7 +37,7 @@
xserver.libinput.enable = true;
xserver.libinput.touchpad.disableWhileTyping = true;
printing.enable = true;
logind.lidSwitch = "suspend-and-hibernate";
logind.lidSwitch = "hybrid-sleep";
};
hardware.bluetooth.enable = true;

View file

@ -0,0 +1 @@
"x86_64-linux"

View file

@ -47,4 +47,34 @@ lib.makeExtensible (_: rec {
mapModules' = f: dir: lib.attrValues (mapModules f dir);
listModules = mapModules' (path: path);
mapModulesRec = f: dir:
let
filterDirs = name: type:
let
isPublic = !(lib.hasPrefix "_" name);
isSomething = type != null;
isDir = type == "directory";
isDefault = isDir && builtins.pathExists "${toString dir}/${name}/default.nix";
in
isPublic && isSomething && isDir && !isDefault;
subDirs = lib.filterAttrs filterDirs (builtins.readDir dir);
mkSubModule = name: _:
let
path = "${toString dir}/${name}";
in
lib.nameValuePair name (mapModulesRec f path);
in
mapModules f dir //
(lib.mapAttrs' mkSubModule subDirs);
mapModulesRec' = f: dir:
let
attrValuesRec = attrs: map (values: if lib.isAttrs values then attrValuesRec values else values) (lib.attrValues attrs);
in
lib.flatten (attrValuesRec (mapModulesRec f dir));
listModulesRec = mapModulesRec' (path: path);
})

View file

@ -7,10 +7,10 @@
with lib;
let
cfg = config.my.bin;
cycleSinks = import ./cycleSinks.nix { inherit pkgs; };
protonge = import ./protonge.nix { inherit pkgs; };
share = import ./share.nix { inherit pkgs; };
sxhkdHelp = import ./sxhkdHelp.nix { inherit pkgs; };
cycleSinks = import ./_cycleSinks.nix { inherit pkgs; };
protonge = import ./_protonge.nix { inherit pkgs; };
share = import ./_share.nix { inherit pkgs; };
sxhkdHelp = import ./_sxhkdHelp.nix { inherit pkgs; };
in
{
options.my.bin.enable = mkEnableOption "bin";

View file

@ -1,5 +0,0 @@
{ lib, ... }:
{
imports = lib.my.listModules ./.;
}

View file

@ -6,7 +6,7 @@ let
in
{
config = mkIf (cfg.enable && cfg.scheme == "catppuccin-frappe")
(import ./catppuccin.nix
(import ./_catppuccin.nix
{
inherit config lib pkgs;
flavor = "mocha";

View file

@ -6,7 +6,7 @@ let
in
{
config = mkIf (cfg.enable && cfg.scheme == "catppuccin-latte")
(import ./catppuccin.nix
(import ./_catppuccin.nix
{
inherit config lib pkgs;
flavor = "mocha";

View file

@ -6,7 +6,7 @@ let
in
{
config = mkIf (cfg.enable && cfg.scheme == "catppuccin-macchiato")
(import ./catppuccin.nix
(import ./_catppuccin.nix
{
inherit config lib pkgs;
flavor = "mocha";

View file

@ -6,7 +6,7 @@ let
in
{
config = mkIf (cfg.enable && cfg.scheme == "catppuccin-mocha")
(import ./catppuccin.nix
(import ./_catppuccin.nix
{
inherit config lib pkgs;
flavor = "mocha";

View file

Before

Width:  |  Height:  |  Size: 12 MiB

After

Width:  |  Height:  |  Size: 12 MiB

View file

Before

Width:  |  Height:  |  Size: 5.2 MiB

After

Width:  |  Height:  |  Size: 5.2 MiB

View file

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

View file

Before

Width:  |  Height:  |  Size: 4.6 MiB

After

Width:  |  Height:  |  Size: 4.6 MiB

View file

Before

Width:  |  Height:  |  Size: 10 MiB

After

Width:  |  Height:  |  Size: 10 MiB

View file

Before

Width:  |  Height:  |  Size: 501 KiB

After

Width:  |  Height:  |  Size: 501 KiB

View file

Before

Width:  |  Height:  |  Size: 635 KiB

After

Width:  |  Height:  |  Size: 635 KiB

View file

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

View file

@ -1,9 +1,4 @@
{ lib, ... }:
{
imports = [
./config
./programs
./security
./services
./virtualisation
];
imports = lib.my.listModulesRec ./.;
}

View file

@ -1,74 +1,84 @@
{ lib
, config
, pkgs
, ...
}:
with lib; {
my = {
yubikey = {
enable = mkDefault true;
luksSupport = {
with lib;
let
cfg = config.my.profiles.desktop;
in
{
options.my.profiles.desktop.enable = mkEnableOption "desktop profile";
config = mkIf cfg.enable {
my = {
yubikey = {
enable = mkDefault true;
devices = mkDefault [ "enc" ];
luksSupport = {
enable = mkDefault true;
devices = mkDefault [ "enc" ];
};
};
wallpapers.enable = mkDefault true;
theming = {
enable = mkDefault true;
scheme = mkDefault "catppuccin-macchiato";
};
virtualisation.podman.enable = mkDefault true;
programs = {
chromium.enable = mkDefault true;
firefox.enable = mkDefault true;
gpg.enable = mkDefault true;
hyprland.enable = mkDefault true;
logseq.enable = mkDefault true;
nvim.enable = mkDefault true;
python.versions."311".enable = mkDefault true;
spotify.enable = mkDefault true;
ssh.enable = mkDefault true;
thunar.enable = mkDefault true;
wallpaper.enable = mkDefault true;
zathura.enable = mkDefault true;
};
services = {
dunst.enable = mkDefault true;
gammastep.enable = true;
kdeconnect.enable = mkDefault true;
printing.enable = true;
wireguard.enable = true;
};
};
wallpapers.enable = mkDefault true;
theming = {
enable = mkDefault true;
scheme = mkDefault "catppuccin-macchiato";
};
virtualisation.podman.enable = mkDefault true;
programs = {
chromium.enable = mkDefault true;
firefox.enable = mkDefault true;
gpg.enable = mkDefault true;
hyprland.enable = mkDefault true;
logseq.enable = mkDefault true;
nvim.enable = mkDefault true;
python.versions."311".enable = mkDefault true;
spotify.enable = mkDefault true;
ssh.enable = mkDefault true;
thunar.enable = mkDefault true;
wallpaper.enable = mkDefault true;
zathura.enable = mkDefault true;
environment.systemPackages = with pkgs; [
anki
calibre
keepassxc
nixpkgs-review
pavucontrol
stable.libreoffice # HACK to fix build error
stable.signal-desktop
texlive.combined.scheme-full
thunderbird
vlc
];
programs.nix-ld.enable = true;
home-manager.users.moritz = {
services.nextcloud-client = {
enable = true;
startInBackground = true;
};
};
services = {
dunst.enable = mkDefault true;
gammastep.enable = true;
kdeconnect.enable = mkDefault true;
printing.enable = true;
wireguard.enable = true;
};
};
environment.systemPackages = with pkgs; [
anki
calibre
keepassxc
nixpkgs-review
pavucontrol
stable.libreoffice # HACK to fix build error
stable.signal-desktop
texlive.combined.scheme-full
thunderbird
vlc
];
programs.nix-ld.enable = true;
home-manager.users.moritz = {
services.nextcloud-client = {
enable = true;
startInBackground = true;
};
};
services = {
illum.enable = true;
gnome.gnome-keyring.enable = true;
pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
illum.enable = true;
gnome.gnome-keyring.enable = true;
pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
};
};
};
}

View file

@ -1,11 +1,23 @@
{ pkgs
{ lib
, config
, pkgs
, ...
}: {
programs.steam.enable = true;
environment.systemPackages = with pkgs; [
lutris
legendary-gl
heroic
mangohud
];
}:
with lib;
let
cfg = config.my.profiles.gaming;
in
{
options.my.profiles.gaming.enable = mkEnableOption "Enable gaming profile";
config = mkIf cfg.enable {
programs.steam.enable = true;
environment.systemPackages = with pkgs; [
lutris
legendary-gl
heroic
mangohud
];
};
}

View file

@ -1,63 +1,74 @@
{ lib, ... }:
{ lib
, config
, ...
}:
with lib;
let
cfg = config.my.profiles.personal;
in
{
my = {
services = {
openconnect.enable = true;
synology-drive.enable = true;
};
programs = {
ssh.includeSecrets = mkDefault [ ../../secrets/ssh-home.age ];
git.signing = mkDefault true;
hub.enable = mkDefault true;
firefox.arkenfox = {
enable = mkDefault true;
overrides = mkDefault {
## arkenfox overrides
# automatic search
"keyword.enabled" = true;
"browser.search.suggest.enabled" = true;
"browser.urlbar.suggest.searches" = true;
options.my.profiles.personal.enable = mkEnableOption "personal profile";
# startup page
"browser.startup.homepage" = "https://searxng.moritzboeh.me/";
"browser.startup.page" = 1;
config = mkIf cfg.enable
{
my = {
services = {
openconnect.enable = true;
synology-drive.enable = true;
};
programs = {
ssh.includeSecrets = mkDefault [ ../../secrets/ssh-home.age ];
git.signing = mkDefault true;
hub.enable = mkDefault true;
firefox.arkenfox = {
enable = mkDefault true;
overrides = mkDefault {
## arkenfox overrides
# automatic search
"keyword.enabled" = true;
"browser.search.suggest.enabled" = true;
"browser.urlbar.suggest.searches" = true;
# drm
"media.eme.enabled" = true;
# startup page
"browser.startup.homepage" = "https://searxng.moritzboeh.me/";
"browser.startup.page" = 1;
# sanitisation
"privacy.clearOnShutdown.history" = false;
# drm
"media.eme.enabled" = true;
# disable letterboxing
"privacy.resistFingerprinting.letterboxing" = false;
# sanitisation
"privacy.clearOnShutdown.history" = false;
## OTHER
# Dont show warning when accessing about:config
"browser.aboutConfig.showWarning" = false;
# disable letterboxing
"privacy.resistFingerprinting.letterboxing" = false;
# Hide bookmarks
"browser.toolbars.bookmarks.visibility" = "never";
## OTHER
# Dont show warning when accessing about:config
"browser.aboutConfig.showWarning" = false;
# Smooth scrolling
"general.smoothScroll.lines.durationMaxMS" = 125;
"general.smoothScroll.lines.durationMinMS" = 125;
"general.smoothScroll.mouseWheel.durationMaxMS" = 200;
"general.smoothScroll.mouseWheel.durationMinMS" = 100;
"general.smoothScroll.msdPhysics.enabled" = true;
"general.smoothScroll.other.durationMaxMS" = 125;
"general.smoothScroll.other.durationMinMS" = 125;
"general.smoothScroll.pages.durationMaxMS" = 125;
"general.smoothScroll.pages.durationMinMS" = 125;
"mousewheel.min_line_scroll_amount" = 40;
"mousewheel.system_scroll_override_on_root_content.enabled" = true;
"mousewheel.system_scroll_override_on_root_content.horizontal.factor" = 175;
"mousewheel.system_scroll_override_on_root_content.vertical.factor" = 175;
"toolkit.scrollbox.horizontalScrollDistance" = 6;
"toolkit.scrollbox.verticalScrollDistance" = 2;
# Hide bookmarks
"browser.toolbars.bookmarks.visibility" = "never";
# Smooth scrolling
"general.smoothScroll.lines.durationMaxMS" = 125;
"general.smoothScroll.lines.durationMinMS" = 125;
"general.smoothScroll.mouseWheel.durationMaxMS" = 200;
"general.smoothScroll.mouseWheel.durationMinMS" = 100;
"general.smoothScroll.msdPhysics.enabled" = true;
"general.smoothScroll.other.durationMaxMS" = 125;
"general.smoothScroll.other.durationMinMS" = 125;
"general.smoothScroll.pages.durationMaxMS" = 125;
"general.smoothScroll.pages.durationMinMS" = 125;
"mousewheel.min_line_scroll_amount" = 40;
"mousewheel.system_scroll_override_on_root_content.enabled" = true;
"mousewheel.system_scroll_override_on_root_content.horizontal.factor" = 175;
"mousewheel.system_scroll_override_on_root_content.vertical.factor" = 175;
"toolkit.scrollbox.horizontalScrollDistance" = 6;
"toolkit.scrollbox.verticalScrollDistance" = 2;
};
};
};
};
};
};
}

View file

@ -1,10 +1,23 @@
{ pkgs }:
{ lib
, config
, pkgs
, ...
}:
with lib;
let
cfg = config.my.profiles.ripping;
in
{
environment.systemPackages = with pkgs; [
# ripping
abcde
handbrake
picard
];
options.my.profiles.ripping.enable = mkEnableOption "ripping profile";
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
# ripping
abcde
handbrake
picard
];
};
}

View file

@ -1,5 +0,0 @@
{ lib, ... }:
{
imports = lib.my.listModules ./.;
}

View file

@ -48,7 +48,7 @@ in
enable = true;
package = hyprland;
recommendedEnvironment = true;
extraConfig = import ./config.nix args;
extraConfig = import ./_config.nix args;
};
};

View file

@ -1,6 +1,7 @@
{ config
, lib
, inputs
, self
, ...
}:
@ -22,6 +23,8 @@ in
};
config.nix = {
extraOptions = "experimental-features = nix-command flakes";
gc = {
automatic = cfg.gc.enable;
options = "--max-freed ${cfg.gc.minimumFreedGB} --delete-older-than 14d";
@ -42,6 +45,7 @@ in
master.flake = inputs.master;
nixpkgs.flake = inputs.nixpkgs;
stable.flake = inputs.stable;
dotfiles.flake = self;
};
settings = {

View file

@ -5,7 +5,7 @@ WALLPAPERS=$(find "$WALLPAPERS_PATH" -type f,l)
function help() {
echo "Usage:"
echo -e " wallpaper [OPTIONS] [PATH]"
echo -e " wallpaper [OPTIONS] [PATH]"
echo ""
echo "Options:"
echo -e " -h, --help \n\t Show this help message and exit"
@ -60,12 +60,12 @@ done
set -- "${POSITIONAL[@]}" # restore positional arguments
if [[ $# -gt 1 ]]; then
help
exit 1
help
exit 1
fi
if [[ $# -eq 1 ]]; then
WALLPAPER="$1"
WALLPAPER="$1"
fi
if [[ -z ${WALLPAPER+x} ]]; then

View file

@ -1,5 +0,0 @@
{ lib, ... }:
{
imports = lib.my.listModules ./.;
}

View file

@ -1,5 +0,0 @@
{ lib, ... }:
{
imports = lib.my.listModules ./.;
}

View file

@ -1,12 +0,0 @@
{ inputs, ... }:
_: prev: {
master = import inputs.master {
inherit (prev) system;
config.allowUnfree = true;
};
stable = import inputs.stable {
inherit (prev) system;
config.allowUnfree = true;
};
}