diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..5142a0b --- /dev/null +++ b/configuration.nix @@ -0,0 +1,117 @@ +{ + config, + lib, + pkgs, + ... +}: + +{ + imports = [ + ./hardware-configuration.nix + ./packages.nix + ]; + + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; + + fileSystems."/media/music" = + { device = "/dev/disk/by-uuid/8e6ae06e-a4b5-4ac8-ad15-cb288b14715f"; + fsType = "ext4"; + }; + + boot.loader.grub = { + enable = true; + zfsSupport = true; + efiSupport = true; + efiInstallAsRemovable = true; + mirroredBoots = [ + { + devices = [ "nodev" ]; + path = "/boot"; + } + ]; + }; + + fileSystems."/" = { + device = "zpool/root"; + fsType = "zfs"; + }; + fileSystems."/nix" = { + device = "zpool/nix"; + fsType = "zfs"; + }; + fileSystems."/var" = { + device = "zpool/var"; + fsType = "zfs"; + }; + fileSystems."/home" = { + device = "zpool/home"; + fsType = "zfs"; + }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/FCFD-4472"; + fsType = "vfat"; + }; + boot.zfs.forceImportRoot = false; + + swapDevices = [ ]; + + networking.hostId = "6054e036"; + + networking.hostName = "nixos-music"; + + networking.networkmanager.enable = true; + + time.timeZone = "Europe/Berlin"; + + i18n.defaultLocale = "en_US.UTF-8"; + console = { + font = "Lat2-Terminus16"; + keyMap = "de"; + }; + + programs.fish.enable = true; + users.users.user = { + isNormalUser = true; + description = "user"; + uid = 1000; + extraGroups = [ + "networkmanager" + "wheel" + "docker" + ]; + shell = pkgs.fish; + }; + + services.rsync.enable = true; + programs.nh.enable = true; + programs.neovim.enable = true; + programs.git = { + enable = true; + config = { + user = { + name = "KeksNino"; + email = "KeksNino@proton.me"; + }; + init = { + defaultBranch = "main"; + }; + push = { + autoSetupRemote = true; + }; + }; + }; + + services.openssh = { + enable = true; + openFirewall = true; + settings = { + PasswordAuthentication = false; + PermitRootLogin = "no"; + }; + }; + + system.stateVersion = "26.05"; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..a2e2cc5 --- /dev/null +++ b/flake.lock @@ -0,0 +1,48 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1784725727, + "narHash": "sha256-J5+C9wsO0lhDyUalQzfplDbRjyHDYeEH5+9sdyXtwa8=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "041a999e8c1c5b731913855909e68d30ca69b8e0", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1784497964, + "narHash": "sha256-vlHUuqAcbcH2RKmHbPiuQzbv1pnzzavXnI62RD0bqCU=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "241313f4e8e508cb9b13278c2b0fa25b9ca27163", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..3423101 --- /dev/null +++ b/flake.nix @@ -0,0 +1,38 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = + { + self, + nixpkgs, + home-manager, + }: + let + system = "x86_64-linux"; + in + { + nixosConfigurations.nixos-music = nixpkgs.lib.nixosSystem { + inherit system; + modules = [ + ./configuration.nix + ./hardware-configuration.nix + home-manager.nixosModules.home-manager + { + + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + + home-manager.users.user = import ./home-manager/home.nix; + + home-manager.backupFileExtension = "backup"; + } + ]; + }; + }; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..7114f67 --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,46 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "uas" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "zpool/root"; + fsType = "zfs"; + }; + + fileSystems."/var" = + { device = "zpool/var"; + fsType = "zfs"; + }; + + fileSystems."/nix" = + { device = "zpool/nix"; + fsType = "zfs"; + }; + + fileSystems."/home" = + { device = "zpool/home"; + fsType = "zfs"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/FCFD-4472"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = [ ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/home-manager/home.nix b/home-manager/home.nix new file mode 100644 index 0000000..7723074 --- /dev/null +++ b/home-manager/home.nix @@ -0,0 +1,57 @@ +{pkgs, ... }: +{ + home.username = "user"; + home.homeDirectory = "/home/user"; + + programs.yazi.enable = true; + programs.yazi.enableFishIntegration = true; + + programs.fzf.enable = true; + programs.fzf.enableFishIntegration = true; + + programs.zoxide.enable = true; + programs.zoxide.enableFishIntegration = true; + + programs.gcc.enable = true; + + programs.eza = { + enable = true; + enableFishIntegration = true; + git = true; + icons = "always"; + extraOptions = [ + "-1" + ]; + }; + + programs.btop.enable = true; + programs.fastfetch.enable = true; + programs.fd.enable = true; + + home.sessionVariables = { + EDITOR = "nvim"; + }; + + programs.fish = { + enable = true; + interactiveShellInit = '' + set -g fish_key_bindings fish_hybrid_key_bindings + set fish_greeting + ''; + shellAliases = { + ls = "eza -al --no-time --no-user --no-permissions --no-filesize"; + ll = "eza -la"; + cat = "bat"; + cd = "z"; + cp = "cp -v"; + ff = "fastfetch"; + grep = "grep -i"; + mv = "mv -v"; + n = "nvim"; + r = "rsync -avh --info=progress2"; + rm = "gomi"; + }; + }; + + home.stateVersion = "26.05"; +} diff --git a/packages.nix b/packages.nix new file mode 100644 index 0000000..da3e934 --- /dev/null +++ b/packages.nix @@ -0,0 +1,18 @@ +{ pkgs, ... }: { + + environment.systemPackages = with pkgs; [ + wget + nixfmt + tree-sitter + lsof + exiftool + trash-cli + ffmpeg + unzip + scdl + aria2 + python3 + nodejs + gomi + ]; +}