diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..9bd7952 --- /dev/null +++ b/flake.lock @@ -0,0 +1,95 @@ +{ + "nodes": { + "emacs-overlay": { + "locked": { + "lastModified": 1623260469, + "narHash": "sha256-zEisFZsGiAiI4k0D+zd1g+j+/YEEdzxIhmGV1fEcVZw=", + "owner": "nix-community", + "repo": "emacs-overlay", + "rev": "7a60fbc3fbcd1ac549af35db2b54c53b0b99da6e", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "emacs-overlay", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1623251710, + "narHash": "sha256-eCMquRJXAzzFgNcTO4jQqp8D40N0jSA58+oqhyOrEbU=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "42847469b3f65a363dc52b66be09d0ac4edcc55c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixos-hardware": { + "locked": { + "lastModified": 1623143341, + "narHash": "sha256-a8NjpJVvJkb3ehu/KP1OaWwlRexom2D7lQEH5uCO9yA=", + "owner": "nixos", + "repo": "nixos-hardware", + "rev": "fccbee72df707c3fb074854668deee6e1ff02351", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixos-hardware", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1622966049, + "narHash": "sha256-6g+28v94ISkVk9TBSsITVOnB2slK8plieWPIF2jo/l0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "fbfb79400a08bf754e32b4d4fc3f7d8f8055cf94", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1623267925, + "narHash": "sha256-qCQMqKqBrTHaPcxL8nSlUO+gWT+f96RmBr2lHGXKHSk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "83f6711464e03a856fb554693fe2e0f3af2ab0d5", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "master", + "type": "indirect" + } + }, + "root": { + "inputs": { + "emacs-overlay": "emacs-overlay", + "home-manager": "home-manager", + "nixos-hardware": "nixos-hardware", + "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..d1bf313 --- /dev/null +++ b/flake.nix @@ -0,0 +1,65 @@ +# This file is controlled by /etc/dotfiles/README.org +{ + description = "Immutable NixOS dotfiles."; + + inputs = { + nixpkgs.url = "nixpkgs/nixos-unstable"; + nixpkgs-unstable.url = "nixpkgs/master"; + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + emacs-overlay.url = "github:nix-community/emacs-overlay"; + nixos-hardware.url = "github:nixos/nixos-hardware"; + }; + + outputs = inputs @ { self, nixpkgs, nixpkgs-unstable, ... }: { + nixosConfigurations = { + nixos = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + modules = [ + ./hosts/nixos + ./modules/x11.nix + ./modules/flakes.nix + ./modules/cachix.nix + inputs.home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.chris = { + imports = [ + ./modules/git.nix + ./modules/gpg.nix + ./modules/vim.nix + ./modules/gtk.nix + ./modules/emacs.nix + ]; + }; + } + ]; + }; + # NOTE: Work In Progress! + # acernitro = nixpkgs.lib.nixosSystem { + # system = "x86_64-linux"; + # specialArgs = { inherit inputs; }; + # modules = [ + # ./hosts/acernitro + # ./modules/x11.nix + # ./modules/flakes.nix + # ./modules/cachix.nix + # inputs.home-manager.nixosModules.home-manager { + # home-manager.useGlobalPkgs = true; + # home-manager.useUserPackages = true; + # home-manager.users.chris = { + # imports = [ + # ./modules/git.nix + # ./modules/gpg.nix + # ./modules/vim.nix + # ./modules/gtk.nix + # ./modules/emacs.nix + # ]; + # }; + # } + # ]; + # }; + }; + }; +} diff --git a/hosts/acernitro/default.nix b/hosts/acernitro/default.nix new file mode 100644 index 0000000..8454369 --- /dev/null +++ b/hosts/acernitro/default.nix @@ -0,0 +1,9 @@ +# This file is controlled by /etc/dotfiles/README.org +{ ... }: + +{ + imports = [ + ./configuration.nix + ./hardware.nix + ]; +} diff --git a/hosts/nixos/configuration.nix b/hosts/nixos/configuration.nix new file mode 100644 index 0000000..be679e6 --- /dev/null +++ b/hosts/nixos/configuration.nix @@ -0,0 +1,25 @@ +# This file is controlled by /etc/dotfiles/README.org +{ config, pkgs, inputs, ... }: + +{ + boot.loader.grub.enable = true; + boot.loader.grub.version = 2; + boot.loader.grub.device = "/dev/sda"; + + time.timeZone = "America/Toronto"; + + networking.hostName = "nixos"; + networking.useDHCP = false; + networking.firewall.enable = false; + networking.interfaces.ens3.useDHCP = true; + + programs.mtr.enable = true; + programs.fish.enable = true; + programs.gnupg.agent.enable = true; + + users.users.chris = { + shell = pkgs.fish; + isNormalUser = true; + extraGroups = [ "wheel" ]; + }; +} diff --git a/hosts/nixos/default.nix b/hosts/nixos/default.nix new file mode 100644 index 0000000..8454369 --- /dev/null +++ b/hosts/nixos/default.nix @@ -0,0 +1,9 @@ +# This file is controlled by /etc/dotfiles/README.org +{ ... }: + +{ + imports = [ + ./configuration.nix + ./hardware.nix + ]; +} diff --git a/hosts/nixos/hardware.nix b/hosts/nixos/hardware.nix new file mode 100644 index 0000000..b98dee7 --- /dev/null +++ b/hosts/nixos/hardware.nix @@ -0,0 +1,22 @@ +# This file is controlled by /etc/dotfiles/README.org +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ata_piix" "floppy" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/fddc37ff-a442-41fa-afc4-abf878be7c5a"; + fsType = "ext4"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/5fc0e3df-e796-4fe2-8482-c6acaed9d36f"; } + ]; +} diff --git a/modules/cachix.nix b/modules/cachix.nix new file mode 100644 index 0000000..632f282 --- /dev/null +++ b/modules/cachix.nix @@ -0,0 +1,13 @@ +# This file is controlled by /etc/dotfiles/README.org +{ config, ... }: + +{ + nix = { + binaryCaches = [ + "https://nix-community.cachix.org" + ]; + binaryCachePublicKeys = [ + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + }; +} diff --git a/modules/flakes.nix b/modules/flakes.nix new file mode 100644 index 0000000..cf18b9e --- /dev/null +++ b/modules/flakes.nix @@ -0,0 +1,16 @@ +# This file is controlled by /etc/dotfiles/README.org +{ config, pkgs, inputs, ... }: + +{ + nix = { + package = pkgs.nixUnstable; + extraOptions = '' + experimental-features = nix-command flakes + ''; + }; + + nixpkgs = { + config = { allowUnfree = true; }; + overlays = [ inputs.emacs-overlay.overlay ]; + }; +} diff --git a/modules/git.nix b/modules/git.nix new file mode 100644 index 0000000..fbfa79b --- /dev/null +++ b/modules/git.nix @@ -0,0 +1,15 @@ +# This file is controlled by /etc/dotfiles/README.org +{ pkgs, ... }: + +{ + programs.git = { + enable = true; + userName = "Christopher James Hayward"; + userEmail = "chris@chrishayward.xyz"; + + signing = { + key = "37AB1CB72B741E478CA026D43025DCBD46F81C0F"; + signByDefault = true; + }; + }; +} diff --git a/modules/gpg.nix b/modules/gpg.nix new file mode 100644 index 0000000..2eb186a --- /dev/null +++ b/modules/gpg.nix @@ -0,0 +1,11 @@ +# This file is controlled by /etc/dotfiles/README.org +{ pkgs, ... }: + +{ + services.gpg-agent = { + enable = true; + defaultCacheTtl = 1800; + enableSshSupport = true; + pinentryFlavor = "gtk2"; + }; +} diff --git a/modules/gtk.nix b/modules/gtk.nix new file mode 100644 index 0000000..9699592 --- /dev/null +++ b/modules/gtk.nix @@ -0,0 +1,27 @@ +# This file is controlled by /etc/dotfiles/README.org +{ pkgs, ... }: + +{ + home.packages = [ + pkgs.nordic + pkgs.lxappearance + ]; + + home.file.".gtkrc-2.0" = { + text = '' + gtk-theme-name="Nordic-bluish-accent" + gtk-icon-theme-name="Adwaita" + gtk-font-name="Sans 10" + gtk-cursor-theme-size=0 + gtk-toolbar-style=GTK_TOOLBAR_BOTH_HORIZ + gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR + gtk-button-images=0 + gtk-menu-images=0 + gtk-enable-event-sounds=1 + gtk-enable-input-feedback-sounds=1 + gtk-xft-antialias=1 + gtk-xft-hinting=1 + gtk-xft-hintstyle="hintmedium" + ''; + }; +} diff --git a/modules/vim.nix b/modules/vim.nix new file mode 100644 index 0000000..b273fdd --- /dev/null +++ b/modules/vim.nix @@ -0,0 +1,23 @@ +# This file is controlled by /etc/dotfiles/README.org +{ pkgs, ... }: + +{ + programs.neovim = { + enable = true; + viAlias = true; + vimAlias = true; + vimdiffAlias = true; + extraConfig = '' + set number relativenumber + set nobackup + ''; + extraPackages = [ + pkgs.nixfmt + ]; + plugins = with pkgs.vimPlugins; [ + vim-nix + vim-airline + vim-polyglot + ]; + }; +} diff --git a/modules/x11.nix b/modules/x11.nix new file mode 100644 index 0000000..47f0b89 --- /dev/null +++ b/modules/x11.nix @@ -0,0 +1,28 @@ +# This file is controlled by /etc/dotfiles/README.org +{ config, pkgs, ... }: + +{ + services.xserver.enable = true; + services.xserver.layout = "us"; + services.xserver.libinput.enable = true; + services.xserver.displayManager.startx.enable = true; + + environment = { + systemPackages = with pkgs; [ + pkgs.sqlite + ]; + extraInit = '' + export XAUTHORITY=/tmp/Xauthority + [ -e ~/.Xauthority ] && mv -f ~/.Xauthority "$XAUTHORITY" + ''; + }; + + services.picom.enable = true; + services.openssh.enable = true; + services.printing.enable = true; + + fonts.fonts = with pkgs; [ + iosevka + emacs-all-the-icons-fonts + ]; +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..2891792 --- /dev/null +++ b/shell.nix @@ -0,0 +1,19 @@ +# This file is controlled by /etc/dotfiles/README.org +{ pkgs ? import { } }: + +with pkgs; + +let + nixBin = writeShellScriptBin "nix" '' + ${nixFlakes}/bin/nix --option experimental-features "nix-command flakes" "$@" + ''; + +in mkShell { + buildInputs = [ + git + ]; + shellHook = '' + export FLAKE=$(pwd) + export PATH=$FLAKE/bin:${nixBin}/bin:$PATH" + ''; +} diff --git a/shells/.git-keep b/shells/.git-keep new file mode 100644 index 0000000..e69de29