JOK7DA5XBOK2MIVR7ORTSAEMQ6U5642I537IGUYBX67DPFF5QJ3QC
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1650374568,
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"nmd": {
"flake": false,
"locked": {
"lastModified": 1653339422,
"narHash": "sha256-8nc7lcYOgih3YEmRMlBwZaLLJYpLPYKBlewqHqx8ieg=",
"owner": "rycee",
"repo": "nmd",
"rev": "9e7a20e6ee3f6751f699f79c0b299390f81f7bcd",
"type": "gitlab"
},
"original": {
"owner": "rycee",
"repo": "nmd",
"type": "gitlab"
}
},
"nmt": {
"flake": false,
"locked": {
"lastModified": 1648075362,
"narHash": "sha256-u36WgzoA84dMVsGXzml4wZ5ckGgfnvS0ryzo/3zn/Pc=",
"owner": "rycee",
"repo": "nmt",
"rev": "d83601002c99b78c89ea80e5e6ba21addcfe12ae",
"type": "gitlab"
},
"original": {
"owner": "rycee",
"repo": "nmt",
"type": "gitlab"
}
},
},
"utils": {
"locked": {
"lastModified": 1653893745,
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
outputs = { nixpkgs, home-manager, fenix, ... }:
let
system = "x86_64-linux";
username = "nixos";
hmConfig = with nixpkgs.lib; {
outputs = {
nixpkgs,
home-manager,
fenix,
...
}: let
system = "x86_64-linux";
user = "niko";
hmConfig = with nixpkgs.lib;
{
sway ? false
}: { ... }: {
imports = [
./home-manager/home.nix
]
++ optional rust ./home-manager/rust.nix
++ optional sway ./home-manager/sway.nix;
sway ? false,
qute ? false,
imports ? [],
}: {...}: {
imports =
[
./home-manager/home.nix
]
++ optional rust ./home-manager/rust.nix
++ optional sway ./home-manager/sway.nix
++ optional qute ./home-manager/desktop/qute.nix
++ imports;
in {
homeConfigurations.${username} =
home-manager.lib.homeManagerConfiguration {
configuration = hmConfig { rust = true; };
in {
homeConfigurations.wsl = home-manager.lib.homeManagerConfiguration {
configuration = hmConfig {rust = true;};
inherit system username;
homeDirectory = "/home/${username}";
stateVersion = "22.05";
extraSpecialArgs = { inherit fenix; };
};
nixosConfigurations.virtualBox = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
./nixos/virtualBox.nix
({ ... }: { nixpkgs.overlays = [ fenix.overlay ]; })
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.${username} = hmConfig {
rust = true;
sway = true;
};
}
];
};
inherit system user;
homeDirectory = "/home/${user}";
stateVersion = "22.05";
extraSpecialArgs = {inherit fenix;};
};
nixosConfigurations.virtualBox = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {inherit user;};
modules = [
./nixos/virtualBox.nix
({...}: {nixpkgs.overlays = [fenix.overlay];})
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.${user} = hmConfig {
rust = true;
sway = true;
};
}
];
};
nixosConfigurations.legion = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {inherit user;};
modules = [
./nixos/legion.nix
({...}: {nixpkgs.overlays = [fenix.overlay];})
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.${user} = hmConfig {
rust = true;
qute = true;
imports = [
./home-manager/desktop/xorg/i3.nix
./home-manager/pijul.nix
({pkgs, ...}: {
home.packages = with pkgs; [virt-manager];
})
];
};
}
];
{
lib,
pkgs,
...
}: {
home.packages = with pkgs; [dunst libnotify bemenu transmission];
programs.rofi.enable = true;
programs.mpv.enable = true;
services.flameshot.enable = true;
}
{
config,
pkgs,
...
}: {
programs.qutebrowser.enable = true;
}
{pkgs, ...}: {
imports = [../common.nix ./kitty.nix];
home.packages = with pkgs; [bemenu transmission];
xsession.windowManager.i3 = {
enable = true;
package = pkgs.i3-gaps;
config = {
terminal = "kitty";
defaultWorkspace = "workspace number 1";
modifier = "Mod4";
startup = [
{command = "dunst";}
];
menu = "bemenu-run --fn 'DejaVu Sans 15' -c -l 10 -i -w -p 'Run:'";
};
};
# TODO: use autorandr instead of hardcoded `xrandr`
home.file.".xinitrc".text = ''
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto --output DP-0 --left-of eDP-1-1
exec i3
'';
}
{pkgs, ...}: {
programs.kitty = {
enable = true;
settings = {
confirm_os_window_close = 0;
};
extraConfig = ''
include ./paradise.conf
'';
};
xdg.configFile."kitty/paradise.conf".text = ''
foreground #E8E3E3
background #151515
url_color #E8E3E3
# black
color0 #151515
color8 #424242
# red
color1 #B66467
color9 #B66467
# green
color2 #8C977D
color10 #8C977D
# yellow
color3 #D9BC8C
color11 #D9BC8C
# blue
color4 #8DA3B9
color12 #8DA3B9
# magenta
color5 #A988B0
color13 #A988B0
# cyan
color6 #8AA6A2
color14 #8AA6A2
# white
color7 #E8E3E3
color15 #E8E3E3
'';
}
"ui.menu" = { fg = "base05"; bg = "base01"; };
"ui.menu.selected" = { fg = "base01"; bg = "base04"; };
"ui.linenr" = { fg = "base03"; bg = "base01"; };
"ui.popup" = { bg = "base01"; };
"ui.window" = { bg = "base01"; };
"ui.linenr.selected" = { fg = "base04"; bg = "base01"; modifiers = ["bold"]; };
"ui.selection" = { bg = "base02"; };
"comment" = { fg = "base03"; modifiers = ["italic"]; };
"ui.statusline" = { fg = "base04"; bg = "base01"; };
"ui.cursor" = { fg = "base04"; modifiers = ["reversed"]; };
"ui.cursor.primary" = { fg = "base05"; modifiers = ["reversed"]; };
"ui.menu" = {
fg = "base05";
bg = "base01";
};
"ui.menu.selected" = {
fg = "base01";
bg = "base04";
};
"ui.linenr" = {
fg = "base03";
bg = "base01";
};
"ui.popup" = {bg = "base01";};
"ui.window" = {bg = "base01";};
"ui.linenr.selected" = {
fg = "base04";
bg = "base01";
modifiers = ["bold"];
};
"ui.selection" = {bg = "base02";};
"comment" = {
fg = "base03";
modifiers = ["italic"];
};
"ui.statusline" = {
fg = "base04";
bg = "base01";
};
"ui.cursor" = {
fg = "base04";
modifiers = ["reversed"];
};
"ui.cursor.primary" = {
fg = "base05";
modifiers = ["reversed"];
};
"markup.bold" = { fg = "base0A"; modifiers = ["bold"]; };
"markup.italic" = { fg = "base0E"; modifiers = ["italic"]; };
"markup.link.url" = { fg = "base09"; modifiers = ["underlined"]; };
"markup.bold" = {
fg = "base0A";
modifiers = ["bold"];
};
"markup.italic" = {
fg = "base0E";
modifiers = ["italic"];
};
"markup.link.url" = {
fg = "base09";
modifiers = ["underlined"];
};
shellAliases = { l = "exa -lah"; };
functions = { fish_prompt = { body = builtins.readFile ./prompt.fish; }; };
interactiveShellInit = ''
gpg-connect-agent updatestartuptty /bye > /dev/null
'';
shellAliases = let
gpgUpdateTty = "gpg-connect-agent updatestartuptty /bye > /dev/null";
in {
l = "exa -lah";
git = "${gpgUpdateTty} && ${pkgs.git}/bin/git";
ssh = "${gpgUpdateTty} && ${pkgs.openssh}/bin/ssh";
};
functions = {fish_prompt = {body = builtins.readFile ./prompt.fish;};};
{pkgs, ...}: {
home.packages = [pkgs.pijul];
xdg.configFile."pijul/config.toml".source = (pkgs.formats.toml {}).generate "pijul-config" {
author = {
name = "nrabulinski";
full_name = "Nikodem Rabuliński";
email = "nikodem@rabulinski.com";
};
};
}
home.packages = with pkgs; [ bintools clang lldb rustToolchain mold ];
home.file.".cargo/config.toml".source =
(pkgs.formats.toml { }).generate "cargo-config" {
target.x86_64-unknown-linux-gnu = {
linker = "clang";
rustflags = [ "-C" "link-arg=-fuse-ld=${pkgs.mold}/bin/mold" ];
};
home.packages = with pkgs; [bintools clang lldb rustToolchain mold];
home.file.".cargo/config.toml".source = (pkgs.formats.toml {}).generate "cargo-config" {
target.x86_64-unknown-linux-gnu = {
linker = "clang";
rustflags = ["-C" "link-arg=-fuse-ld=${pkgs.mold}/bin/mold"];
{...}: {
services.pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
};
programs.dconf.enable = true;
services.dbus.enable = true;
}
{
pkgs,
user,
...
}: {
users.users.${user}.extraGroups = ["scanner" "lp"];
hardware.sane = {
enable = true;
extraBackends = [pkgs.hplipWithPlugin];
};
services.printing = {
enable = true;
drivers = [pkgs.hplipWithPlugin];
};
}
{
config,
lib,
pkgs,
modulesPath,
user,
...
}: {
imports = [
./common.nix
./desktop.nix
./nvidia.nix
./hp.nix
(modulesPath + "/installer/scan/not-detected.nix")
];
nixpkgs.config.allowUnfree = true;
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.supportedFilesystems = ["btrfs"];
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "uas"];
boot.initrd.luks.devices."enc".device = "/dev/disk/by-label/LUKS";
boot.kernelModules = ["kvm-intel"];
hardware.enableAllFirmware = true;
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
networking.hostName = "legion";
networking.networkmanager.enable = true;
networking.firewall.enable = false;
networking.useDHCP = lib.mkDefault true;
time.timeZone = "Europe/Warsaw";
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "pl";
};
services.usbmuxd.enable = true;
virtualisation.podman = {
enable = true;
dockerCompat = true;
};
virtualisation.libvirtd = {
enable = true;
onBoot = "ignore";
};
users.users.${user}.extraGroups = ["libvirtd"];
services.udisks2 = {
enable = true;
settings = {
"udisks2.conf" = {
defaults = {
encryption = "luks2";
ntfs_defaults = "uid=$UID,gid=$GID";
ntfs_allow = "uid=$UID,gid=$GID,umask,dmask,fmask,locale,norecover,ignore_case,compression,nocompression,big_writes,nls,nohidden,sys_immutable,sparse,showmeta,prealloc";
};
udisks2 = {
modules = ["*"];
modules_load_preference = "ondemand";
};
};
};
};
system.stateVersion = "22.05";
powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
# TODO: Manage those sanely
fileSystems."/" = {
device = "/dev/disk/by-uuid/730d5f4d-35fc-445a-a093-a25db76da899";
fsType = "btrfs";
options = ["subvol=root" "compress=zstd" "noatime"];
};
fileSystems."/home" = {
device = "/dev/disk/by-uuid/730d5f4d-35fc-445a-a093-a25db76da899";
fsType = "btrfs";
options = ["subvol=home" "compress=zstd" "noatime"];
};
fileSystems."/nix" = {
device = "/dev/disk/by-uuid/730d5f4d-35fc-445a-a093-a25db76da899";
fsType = "btrfs";
options = ["subvol=nix" "compress=zstd" "noatime"];
};
fileSystems."/persist" = {
device = "/dev/disk/by-uuid/730d5f4d-35fc-445a-a093-a25db76da899";
fsType = "btrfs";
options = ["subvol=persist" "compress=zstd" "noatime"];
};
fileSystems."/var/log" = {
device = "/dev/disk/by-uuid/730d5f4d-35fc-445a-a093-a25db76da899";
fsType = "btrfs";
options = ["subvol=log" "compress=zstd" "noatime"];
neededForBoot = true;
};
fileSystems."/boot" = {
device = "/dev/disk/by-label/BOOT";
fsType = "vfat";
};
swapDevices = [
{device = "/dev/disk/by-label/SWAP";}
];
}
# This module configures X11 to work with Intel+NVIDIA laptop setup without a mux
# Ref: https://wiki.archlinux.org/title/NVIDIA_Optimus#Use_NVIDIA_graphics_only
#
# This sadly bypasses most of the xorg configuration provided by the NixOS xserver module
#
# TODO: Provide multiple configs to be able to swtich between NVIDIA only and Intel only
# Then it'd be possible to alias multiple commands like
# `startxintel` - `startx -- -config <path to intel-only config>`
{
config,
lib,
pkgs,
...
}: {
services.xserver = {
enable = true;
excludePackages = [pkgs.xterm];
videoDrivers = ["nvidia"];
layout = "pl";
displayManager.startx.enable = true;
config = lib.mkForce ''
Section "OutputClass"
Identifier "intel"
MatchDriver "i915"
Driver "modesetting"
EndSection
Section "OutputClass"
Identifier "nvidia"
MatchDriver "nvidia-drm"
Driver "nvidia"
Option "AllowEmptyInitialConfiguration"
Option "PrimaryGPU" "yes"
ModulePath "${config.hardware.nvidia.package.bin}/lib/xorg/modules"
ModulePath "${pkgs.xorg.xorgserver}/lib/xorg/modules"
EndSection
'';
exportConfiguration = true;
libinput.enable = true;
};
hardware.nvidia = {
package = config.boot.kernelPackages.nvidiaPackages.stable;
modesetting.enable = true;
};
}
boot.initrd.availableKernelModules = [ "ata_piix" "ohci_pci" "ehci_pci" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
boot.initrd.availableKernelModules = ["ata_piix" "ohci_pci" "ehci_pci" "sd_mod" "sr_mod"];
boot.initrd.kernelModules = [];
boot.kernelModules = [];
boot.extraModulePackages = [];