CM2R5CCC4BV75P2MBA4X6OS2H6GQ5BAS34LSU6Y5X3SVKBAFT24AC
HYAPQQOH67GIKQFGP45GE2DFC3WCQTAJUXHQDDK6FZQUGMZ2CZQQC
2EFJUR2TVLHO4R4YRZFLOJKC742HPFI5MOA7II3Y3Z3KOHDNE5JAC
F26DJCZ7RLGRDZSYACB6MGMNTW7L5FE332EBYEIJTBRK7QJ6ZIYAC
JOK7DA5XBOK2MIVR7ORTSAEMQ6U5642I537IGUYBX67DPFF5QJ3QC
BYZGRIFZY253OFK442SR6X743U4LAX4NLFBQ4XPKXEDPPXNNUM4AC
H3GYCX27WTONFBIJN7UIV26LJSCENQJC4XXIOEYINXJLEDGKYJJQC
YVZDXEX34EVRGBLOY4LIDKPFZVMTINZQ5UCAJVDMYSBWIDFPNBQQC
532JIID6XB4NFSIFUA64VEBKWSEJB4AY5OUBIEFUDMWXO7UAZW2QC
ZGEGHEOD2S77CSNWOOFVB7Q3RGOU3WOWDOXJ4S2LKAS2JMS3UAZAC
JHOTQEAZM26AZEYLC3IZVPCZZMXCL7K6V2UEGE3ABGO4GL67AT6QC
QNEDMAXXZFJJNFS2QHPEJZC6OHQEDC4GJBN5GM6G5INR2ME3WSZQC
EVVP46IQ4U6JEDWVJ4D6KT77ABOMY7XKIO2ITX4DHJDRTGTYCUTQC
TXA66OLAOYNGEDRBC4SKWDZPLBZXUU7WHDIAYN4TXGEJR6WIJOIQC
{
config,
lib,
pkgs,
modulesPath,
user,
...
}: {
imports = [
./common.nix
./desktop.nix
./nvidia.nix
./hp.nix
(modulesPath + "/installer/scan/not-detected.nix")
];
nixpkgs.config = {
allowUnfree = true;
chromium.enableWideVine = 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.extraModulePackages = with config.boot.kernelPackages; [acpi_call];
boot.kernelModules = ["kvm-intel" "i2c-dev" "acpi_call"];
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";
};
virtualisation.podman = {
enable = true;
dockerCompat = true;
};
virtualisation.libvirtd = {
enable = true;
onBoot = "ignore";
};
services.xserver.libinput = {
enable = true;
mouse.accelProfile = "flat";
};
users.users.${user}.extraGroups = ["libvirtd" "i2c" "networkmanager"];
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-label/LINUX";
fsType = "btrfs";
options = ["subvol=root" "compress=zstd" "noatime"];
};
fileSystems."/home" = {
device = "/dev/disk/by-label/LINUX";
fsType = "btrfs";
options = ["subvol=home" "compress=zstd" "noatime"];
};
fileSystems."/nix" = {
device = "/dev/disk/by-label/LINUX";
fsType = "btrfs";
options = ["subvol=nix" "compress=zstd" "noatime"];
};
fileSystems."/persist" = {
device = "/dev/disk/by-label/LINUX";
fsType = "btrfs";
options = ["subvol=persist" "compress=zstd" "noatime"];
};
fileSystems."/var/log" = {
device = "/dev/disk/by-label/LINUX";
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";}
];
}
services.usbmuxd.enable = true;
environment.systemPackages = with pkgs; [libimobiledevice ifuse podman-compose];
hardware.opentabletdriver.enable = true;
./steam.nix
./sway.nix
{
flake-lib,
inputs,
inputs',
theme,
stdenv,
lib,
}: let
inherit (stdenv) isDarwin isLinux;
username = flake-lib.const.user;
darwin-specific = [
inputs.home-manager.darwinModules.home-manager
{
services.nix-daemon.enable = true;
security.pam.enableSudoTouchIdAuth = true;
users.users.${username}.home = "/Users/${username}";
}
];
linux-specific = [
inputs.home-manager.nixosModules.home-manager
{
programs.mosh.enable = true;
system.stateVersion = "22.05";
users.users.${username} = {
isNormalUser = true;
extraGroups = ["wheel"];
home = "/home/${username}";
group = username;
};
}
];
# TODO: Make those overridable
builder =
if isDarwin
then inputs.darwin.lib.darwinSystem
else if isLinux
then inputs.nixpkgs.lib.nixosSystem
else throw "Unsupported system";
in
{
system ? {},
user ? {},
}:
builder {
system = stdenv.system;
modules =
[
system
({
lib,
pkgs,
...
}: {
_module.args = {
inherit inputs' theme;
user = username;
# nix-darwin already declares inputs attribute (thanks nix-darwin)<
# but since we're passing all flake inputs this should be fine
inputs = lib.mkForce inputs;
};
nix = {
package = pkgs.nixVersions.stable;
settings.experimental-features = ["nix-command" "flakes"];
registry.nixpkgs.flake = inputs.nixpkgs;
};
programs.fish.enable = true;
environment.shells = [pkgs.fish];
users.users.${username}.shell = pkgs.fish;
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.${username} = flake-lib.mkHome user;
};
})
]
++ (lib.optionals isDarwin darwin-specific)
++ (lib.optionals isLinux linux-specific);
}
{
config,
lib,
pkgs,
modulesPath,
user,
...
}: {
imports = [
../../nixos/common.nix
../../nixos/desktop.nix
../../nixos/nvidia.nix
../../nixos/sway.nix
../../nixos/hp.nix
../../nixos/steam.nix
(modulesPath + "/installer/scan/not-detected.nix")
];
nixpkgs.config = {
allowUnfree = true;
chromium.enableWideVine = true;
};
boot = {
kernelPackages = pkgs.linuxPackages_latest;
supportedFilesystems = ["btrfs"];
loader.systemd-boot.enable = true;
loader.efi.canTouchEfiVariables = true;
initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "uas"];
initrd.luks.devices."enc".device = "/dev/disk/by-label/LUKS";
extraModulePackages = with config.boot.kernelPackages; [acpi_call];
kernelModules = ["kvm-intel" "i2c-dev" "acpi_call"];
};
hardware = {
enableAllFirmware = true;
cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
opentabletdriver.enable = true;
};
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";
};
virtualisation.podman = {
enable = true;
dockerCompat = true;
};
virtualisation.libvirtd = {
enable = true;
onBoot = "ignore";
};
services.xserver.libinput = {
enable = true;
mouse.accelProfile = "flat";
};
users.users.${user}.extraGroups = ["libvirtd" "i2c" "networkmanager"];
services.udisks2.enable = true;
services.usbmuxd.enable = true;
environment.systemPackages = with pkgs; [libimobiledevice ifuse podman-compose];
system.stateVersion = "22.05";
powerManagement.cpuFreqGovernor = "performance";
# TODO: Which of those actually does what I need?
services.longid = {
lidSwitch = "ignore";
lidSwitchDocked = "ignore";
lidSwitchExternalPower = "ignore";
extraConfig = "HandleLidSwitch=ignore";
};
# TODO: Manage those sanely
fileSystems."/" = {
device = "/dev/disk/by-label/LINUX";
fsType = "btrfs";
options = ["subvol=root" "compress=zstd" "noatime"];
};
fileSystems."/home" = {
device = "/dev/disk/by-label/LINUX";
fsType = "btrfs";
options = ["subvol=home" "compress=zstd" "noatime"];
};
fileSystems."/nix" = {
device = "/dev/disk/by-label/LINUX";
fsType = "btrfs";
options = ["subvol=nix" "compress=zstd" "noatime"];
};
fileSystems."/persist" = {
device = "/dev/disk/by-label/LINUX";
fsType = "btrfs";
options = ["subvol=persist" "compress=zstd" "noatime"];
};
fileSystems."/var/log" = {
device = "/dev/disk/by-label/LINUX";
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";}
];
}
{pkgs, ...}: {
services.yabai = {
enable = true;
enableScriptingAddition = true;
config = {
layout = "bsp";
top_padding = 10;
bottom_padding = 10;
left_padding = 10;
right_padding = 10;
window_gap = 10;
window_animation_duration = 0.05;
# TODO: Change this to cmd once https://github.com/koekeishiya/yabai/issues/1551 is resolved
mouse_modifier = "ctrl";
window_topmost = "off";
window_shadow = "float";
# focus_follows_mouse = "autoraise";
mouse_follows_focus = "on";
};
extraConfig = ''
yabai -m rule --add app="^Alacritty$" border=on
yabai -m signal --add event=window_created action='yabai -m query --windows --window $YABAI_WINDOW_ID | ${pkgs.jq}/bin/jq -er ".\"can-resize\" or .\"is-floating\"" || yabai -m window $YABAI_WINDOW_ID --toggle float'
'';
};
}
{pkgs, ...}: {
services.skhd = {
enable = true;
skhdConfig = ''
cmd - return : ${pkgs.alacritty}/Applications/Alacritty.app/Contents/MacOS/alacritty
cmd + shift - return : ${pkgs.qutebrowser}/Applications/qutebrowser.app/Contents/MacOS/qutebrowser
cmd - h : yabai -m window --focus west
cmd - j : yabai -m window --focus south
cmd - k : yabai -m window --focus north
cmd - l : yabai -m window --focus east
cmd - 1 : yabai -m space --focus 1
cmd - 2 : yabai -m space --focus 2
cmd - 3 : yabai -m space --focus 3
cmd - 4 : yabai -m space --focus 4
cmd + shift - space : yabai -m window --toggle float
'';
};
}
flake.darwinConfigurations.hijiri = withSystem "aarch64-darwin" ({
system,
self',
inputs',
...
}: let
inherit (inputs) darwin home-manager fenix nur niko-nur firefox-darwin nixpkgs;
user = self'.lib.const.user;
in
darwin.lib.darwinSystem {
system = "aarch64-darwin";
modules = [
home-manager.darwinModules.home-manager
({
flake.darwinConfigurations.hijiri = withSystem "aarch64-darwin" (
{
system,
self',
inputs',
...
}: let
inherit (inputs) darwin home-manager fenix nur niko-nur firefox-darwin nixpkgs;
in
self'.lib.mkSystem {
system = {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.${user} = self'.lib.mkHome ({
config,
pkgs,
lib,
...
}: {
imports = [
../../home-manager/node.nix
../../home-manager/pijul.nix
../../home-manager/desktop/qute.nix
# ./home-manager/desktop/chromium.nix
];
};
home = {
username = user;
homeDirectory = "/Users/${user}";
stateVersion = "22.05";
};
user = {
config,
pkgs,
lib,
...
}: {
imports = [
../../home-manager/node.nix
../../home-manager/pijul.nix
../../home-manager/desktop/qute.nix
# ./home-manager/desktop/chromium.nix
];
niko = {
desktop.alacritty.enable = true;
dev.rust.enable = true;
};
home.packages = with pkgs; [
nerdfonts
utm
podman
podman-compose
qemu
cocoapods
slack
lunar
anki-bin
transmission-bin
swiftcord
];
programs.firefox = {
enable = true;
package = pkgs.firefox-bin;
};
});
users.users.${user} = {
home = "/Users/${user}";
shell = pkgs.fish;
niko = {
desktop.alacritty.enable = true;
dev.rust.enable = true;
services.yabai = {
enable = true;
enableScriptingAddition = true;
config = {
layout = "bsp";
top_padding = 10;
bottom_padding = 10;
left_padding = 10;
right_padding = 10;
window_gap = 10;
window_animation_duration = 0.05;
# TODO: Change this to cmd once https://github.com/koekeishiya/yabai/issues/1551 is resolved
mouse_modifier = "ctrl";
window_topmost = "off";
window_shadow = "float";
# focus_follows_mouse = "autoraise";
mouse_follows_focus = "on";
};
extraConfig = ''
yabai -m rule --add app="^Alacritty$" border=on
yabai -m signal --add event=window_created action='yabai -m query --windows --window $YABAI_WINDOW_ID | ${pkgs.jq}/bin/jq -er ".\"can-resize\" or .\"is-floating\"" || yabai -m window $YABAI_WINDOW_ID --toggle float'
'';
};
home.packages = with pkgs; [
nerdfonts
utm
podman
podman-compose
qemu
cocoapods
slack
lunar
anki-bin
transmission-bin
swiftcord
];
skhdConfig = ''
cmd - return : ${pkgs.alacritty}/Applications/Alacritty.app/Contents/MacOS/alacritty
cmd + shift - return : ${pkgs.qutebrowser}/Applications/qutebrowser.app/Contents/MacOS/qutebrowser
cmd - h : yabai -m window --focus west
cmd - j : yabai -m window --focus south
cmd - k : yabai -m window --focus north
cmd - l : yabai -m window --focus east
cmd - 1 : yabai -m space --focus 1
cmd - 2 : yabai -m space --focus 2
cmd - 3 : yabai -m space --focus 3
cmd - 4 : yabai -m space --focus 4
cmd + shift - space : yabai -m window --toggle float
'';
package = pkgs.firefox-bin;
{
pkgs,
user,
...
}: {
imports = [
./yabai.nix
./skhd.nix
];
}