Personal Nix flake
nixos home-manager nix
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: Initial configuration

+450
+1
.envrc
··· 1 + use flake
+19
.github/workflows/release-please.yml
··· 1 + name: Release please 2 + 3 + on: 4 + push: 5 + branches: 6 + - main 7 + 8 + permissions: 9 + contents: write 10 + pull-requests: write 11 + 12 + jobs: 13 + release-please: 14 + runs-on: ubuntu-latest 15 + steps: 16 + - uses: google-github-actions/release-please-action@v3 17 + with: 18 + release-type: simple 19 + package-name: release-please-action
+2
.gitignore
··· 1 + .direnv 2 + home.nix
+13
.pre-commit-config.yaml
··· 1 + # See https://pre-commit.com for more information 2 + # See https://pre-commit.com/hooks.html for more hooks 3 + repos: 4 + - repo: https://github.com/pre-commit/pre-commit-hooks 5 + rev: v3.2.0 6 + hooks: 7 + - id: check-merge-conflict 8 + - id: trailing-whitespace 9 + - id: end-of-file-fixer 10 + - repo: https://github.com/nix-community/nixpkgs-fmt 11 + rev: v1.3.0 12 + hooks: 13 + - id: nixpkgs-fmt
+82
flake.lock
··· 1 + { 2 + "nodes": { 3 + "disko": { 4 + "inputs": { 5 + "nixpkgs": [ 6 + "nixpkgs" 7 + ] 8 + }, 9 + "locked": { 10 + "lastModified": 1700927249, 11 + "narHash": "sha256-iqmIWiEng890/ru7ZBf4nUezFPyRm2fjRTvuwwxqk2o=", 12 + "owner": "nix-community", 13 + "repo": "disko", 14 + "rev": "3cb78c93e6a02f494aaf6aeb37481c27a2e2ee22", 15 + "type": "github" 16 + }, 17 + "original": { 18 + "owner": "nix-community", 19 + "repo": "disko", 20 + "type": "github" 21 + } 22 + }, 23 + "flake-utils": { 24 + "inputs": { 25 + "systems": "systems" 26 + }, 27 + "locked": { 28 + "lastModified": 1694529238, 29 + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", 30 + "owner": "numtide", 31 + "repo": "flake-utils", 32 + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", 33 + "type": "github" 34 + }, 35 + "original": { 36 + "owner": "numtide", 37 + "repo": "flake-utils", 38 + "type": "github" 39 + } 40 + }, 41 + "nixpkgs": { 42 + "locked": { 43 + "lastModified": 1701253981, 44 + "narHash": "sha256-ztaDIyZ7HrTAfEEUt9AtTDNoCYxUdSd6NrRHaYOIxtk=", 45 + "owner": "NixOS", 46 + "repo": "nixpkgs", 47 + "rev": "e92039b55bcd58469325ded85d4f58dd5a4eaf58", 48 + "type": "github" 49 + }, 50 + "original": { 51 + "owner": "NixOS", 52 + "ref": "nixos-unstable", 53 + "repo": "nixpkgs", 54 + "type": "github" 55 + } 56 + }, 57 + "root": { 58 + "inputs": { 59 + "disko": "disko", 60 + "flake-utils": "flake-utils", 61 + "nixpkgs": "nixpkgs" 62 + } 63 + }, 64 + "systems": { 65 + "locked": { 66 + "lastModified": 1681028828, 67 + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 68 + "owner": "nix-systems", 69 + "repo": "default", 70 + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 71 + "type": "github" 72 + }, 73 + "original": { 74 + "owner": "nix-systems", 75 + "repo": "default", 76 + "type": "github" 77 + } 78 + } 79 + }, 80 + "root": "root", 81 + "version": 7 82 + }
+60
flake.nix
··· 1 + { 2 + description = "Personal NixOS flake"; 3 + 4 + inputs = { 5 + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 6 + flake-utils.url = "github:numtide/flake-utils"; 7 + disko = { 8 + url = "github:nix-community/disko"; 9 + inputs.nixpkgs.follows = "nixpkgs"; 10 + }; 11 + }; 12 + 13 + outputs = { self, flake-utils, disko, nixpkgs }@inputs: 14 + flake-utils.lib.eachDefaultSystem (system: 15 + let 16 + pkgs = import nixpkgs { inherit system; }; 17 + makeOsConfig = modulesOrPaths: 18 + let 19 + modules = builtins.map 20 + (x: if (builtins.isPath x) then (import x) else x) 21 + modulesOrPaths; 22 + in 23 + nixpkgs.lib.nixosSystem { 24 + inherit system; 25 + modules = [ 26 + ./traits/base.nix 27 + disko.nixosModules.disko 28 + ] ++ modules; 29 + }; 30 + commonModulesDailyDriver = [ 31 + ./traits/user-lpchaim.nix 32 + ./traits/graphical.nix 33 + ./traits/wayland.nix 34 + ./traits/pipewire.nix 35 + ]; 36 + in 37 + { 38 + packages.nixosConfigurations = { 39 + laptop = makeOsConfig (commonModulesDailyDriver ++ [ 40 + ./hardware/laptop/configuration.nix 41 + ./traits/gnome.nix 42 + ./traits/laptop.nix 43 + ]); 44 + }; 45 + devShells.default = pkgs.mkShell { 46 + packages = with pkgs; [ 47 + nil 48 + nixd 49 + nixpkgs-fmt 50 + pre-commit 51 + rustup 52 + rnix-lsp 53 + ]; 54 + shellHook = '' 55 + pre-commit install 56 + ''; 57 + }; 58 + } 59 + ); 60 + }
+14
hardware/laptop/configuration.nix
··· 1 + # Edit this configuration file to define what should be installed on 2 + # your system. Help is available in the configuration.nix(5) man page, on 3 + # https://search.nixos.org/options and in the NixOS manual (`nixos-help`). 4 + 5 + { config, lib, pkgs, ... }: 6 + 7 + { 8 + imports = [ 9 + ./hardware-configuration.nix 10 + ./disko.nix 11 + ]; 12 + system.stateVersion = "23.11"; 13 + networking.hostName = "laptop"; 14 + }
+56
hardware/laptop/disko.nix
··· 1 + { 2 + disko.devices = { 3 + disk = { 4 + vdb = { 5 + device = "/dev/disk/by-id/nvme-WDSN740-SDDPNQD-512G-1004_23360G804890"; 6 + type = "disk"; 7 + content = { 8 + type = "gpt"; 9 + partitions = { 10 + ESP = { 11 + type = "EF00"; 12 + size = "512M"; 13 + content = { 14 + type = "filesystem"; 15 + format = "vfat"; 16 + mountpoint = "/boot"; 17 + }; 18 + }; 19 + root = { 20 + size = "100%"; 21 + content = { 22 + type = "btrfs"; 23 + extraArgs = [ "-f" ]; # Override existing partition 24 + # Subvolumes must set a mountpoint in order to be mounted, 25 + # unless their parent is mounted 26 + subvolumes = { 27 + # Subvolume name is different from mountpoint 28 + "@" = { 29 + mountOptions = [ "compress=zstd" ]; 30 + mountpoint = "/"; 31 + }; 32 + # Subvolume name is the same as the mountpoint 33 + "@home" = { 34 + mountOptions = [ "compress=zstd" ]; 35 + mountpoint = "/home"; 36 + }; 37 + # Parent is not mounted so the mountpoint must be set 38 + "@nix" = { 39 + mountOptions = [ "compress=zstd" "noatime" ]; 40 + mountpoint = "/nix"; 41 + }; 42 + "@swap" = { 43 + mountpoint = "/.swapvol"; 44 + swap = { 45 + swapfile.size = "17G"; 46 + }; 47 + }; 48 + }; 49 + }; 50 + }; 51 + }; 52 + }; 53 + }; 54 + }; 55 + }; 56 + }
+26
hardware/laptop/hardware-configuration.nix
··· 1 + # Do not modify this file! It was generated by ‘nixos-generate-config’ 2 + # and may be overwritten by future invocations. Please make changes 3 + # to /etc/nixos/configuration.nix instead. 4 + { config, lib, pkgs, modulesPath, ... }: 5 + 6 + { 7 + imports = 8 + [ 9 + (modulesPath + "/installer/scan/not-detected.nix") 10 + ]; 11 + 12 + boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "uas" "sd_mod" "rtsx_usb_sdmmc" ]; 13 + boot.initrd.kernelModules = [ ]; 14 + boot.kernelModules = [ "kvm-intel" ]; 15 + boot.extraModulePackages = [ ]; 16 + 17 + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking 18 + # (the default) this is the recommended approach. When using systemd-networkd it's 19 + # still possible to use this option, but it's recommended to use it in conjunction 20 + # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`. 21 + networking.useDHCP = lib.mkDefault true; 22 + # networking.interfaces.wlo1.useDHCP = lib.mkDefault true; 23 + 24 + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; 25 + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; 26 + }
+105
traits/base.nix
··· 1 + # Edit this configuration file to define what should be installed on 2 + # your system. Help is available in the configuration.nix(5) man page, on 3 + # https://search.nixos.org/options and in the NixOS manual (`nixos-help`). 4 + 5 + { config, lib, pkgs, ... }: 6 + 7 + { 8 + # Use the systemd-boot EFI boot loader. 9 + boot.loader.systemd-boot.enable = true; 10 + boot.loader.efi.canTouchEfiVariables = true; 11 + 12 + # networking.hostName = "nixos"; # Define your hostname. 13 + # Pick only one of the below networking options. 14 + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. 15 + # networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. 16 + 17 + # Set your time zone. 18 + # time.timeZone = "Europe/Amsterdam"; 19 + 20 + # Configure network proxy if necessary 21 + # networking.proxy.default = "http://user:password@proxy:port/"; 22 + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; 23 + 24 + # Select internationalisation properties. 25 + # i18n.defaultLocale = "en_US.UTF-8"; 26 + # console = { 27 + # font = "Lat2-Terminus16"; 28 + # keyMap = "us"; 29 + # useXkbConfig = true; # use xkb.options in tty. 30 + # }; 31 + 32 + # Enable the X11 windowing system. 33 + services.xserver.enable = true; 34 + 35 + # Configure keymap in X11 36 + # services.xserver.xkb.layout = "us"; 37 + # services.xserver.xkb.options = "eurosign:e,caps:escape"; 38 + 39 + # Enable CUPS to print documents. 40 + # services.printing.enable = true; 41 + 42 + # Enable sound. 43 + # sound.enable = true; 44 + # hardware.pulseaudio.enable = true; 45 + 46 + # Enable touchpad support (enabled default in most desktopManager). 47 + # services.xserver.libinput.enable = true; 48 + 49 + # Define a user account. Don't forget to set a password with ‘passwd’. 50 + # users.users.alice = { 51 + # isNormalUser = true; 52 + # extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. 53 + # packages = with pkgs; [ 54 + # firefox 55 + # tree 56 + # ]; 57 + # }; 58 + 59 + # Some programs need SUID wrappers, can be configured further or are 60 + # started in user sessions. 61 + # programs.mtr.enable = true; 62 + # programs.gnupg.agent = { 63 + # enable = true; 64 + # enableSSHSupport = true; 65 + # }; 66 + 67 + # List services that you want to enable: 68 + 69 + # Enable the OpenSSH daemon. 70 + # services.openssh.enable = true; 71 + 72 + # Open ports in the firewall. 73 + # networking.firewall.allowedTCPPorts = [ ... ]; 74 + # networking.firewall.allowedUDPPorts = [ ... ]; 75 + # Or disable the firewall altogether. 76 + # networking.firewall.enable = false; 77 + 78 + # Copy the NixOS configuration file and link it from the resulting system 79 + # (/run/current-system/configuration.nix). This is useful in case you 80 + # accidentally delete configuration.nix. 81 + # system.copySystemConfiguration = true; 82 + 83 + # Programs 84 + programs.zsh.enable = true; 85 + environment.systemPackages = with pkgs; [ 86 + vim 87 + wget 88 + ]; 89 + 90 + # Package manager 91 + nix = { 92 + package = pkgs.nixFlakes; 93 + extraOptions = '' 94 + experimental-features = flakes nix-command 95 + ''; 96 + }; 97 + 98 + # Internationalization 99 + time.timeZone = "America/Sao_Paulo"; 100 + i18n.defaultLocale = "en_US.UTF-8"; 101 + time.hardwareClockInLocalTime = true; 102 + 103 + # Graphics 104 + hardware.opengl.enable = true; 105 + }
+8
traits/gnome.nix
··· 1 + # Use the GNOME desktop environment 2 + 3 + { ... }: 4 + 5 + { 6 + services.xserver.displayManager.gdm.enable = true; 7 + services.xserver.desktopManager.gnome.enable = true; 8 + }
+8
traits/graphical.nix
··· 1 + # Enable graphical session 2 + 3 + { ... }: 4 + 5 + { 6 + services.xserver.enable = true; 7 + hardware.opengl.enable = true; 8 + }
+10
traits/laptop.nix
··· 1 + # Laptop configurations 2 + 3 + { config, lib, pkgs, ... }: 4 + 5 + { 6 + hardware.sensor.iio.enable = true; 7 + services.thermald.enable = true; 8 + # services.tlp.enable = true; 9 + services.auto-cpufreq.enable = true; 10 + }
+15
traits/pipewire.nix
··· 1 + # Use pipewire audio 2 + 3 + { ... }: 4 + 5 + { 6 + hardware.pulseaudio.enable = false; 7 + security.rtkit.enable = true; 8 + services.pipewire = { 9 + enable = true; 10 + alsa.enable = true; 11 + alsa.support32Bit = true; 12 + pulse.enable = true; 13 + jack.enable = true; 14 + }; 15 + }
+23
traits/user-lpchaim.nix
··· 1 + # Edit this configuration file to define what should be installed on 2 + # your system. Help is available in the configuration.nix(5) man page, on 3 + # https://search.nixos.org/options and in the NixOS manual (`nixos-help`). 4 + 5 + { pkgs, ... }: 6 + 7 + { 8 + users = { 9 + # mutableUsers = false; 10 + # users.root.hashedPassword = "!"; 11 + groups.lpchaim = { 12 + gid = 1000; 13 + }; 14 + users.lpchaim = { 15 + isNormalUser = true; 16 + home = "/home/lpchaim"; 17 + description = "Lucas Chaim"; 18 + group = "lpchaim"; 19 + extraGroups = [ "wheel" "networkmanager" ]; 20 + shell = pkgs.zsh; 21 + }; 22 + }; 23 + }
+8
traits/wayland.nix
··· 1 + # Use wayland instead of X11 2 + 3 + { ... }: 4 + 5 + { 6 + services.xserver.displayManager.gdm.wayland = true; 7 + programs.xwayland.enable = true; 8 + }