summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--flake.lock49
-rw-r--r--flake.nix32
-rw-r--r--home.nix79
-rw-r--r--hosts/oracle/configuration.nix91
-rw-r--r--hosts/oracle/hardware-configuration.nix42
6 files changed, 294 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b2be92b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
result
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..4bf0850
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,49 @@
1{
2 "nodes": {
3 "home-manager": {
4 "inputs": {
5 "nixpkgs": [
6 "nixpkgs"
7 ]
8 },
9 "locked": {
10 "lastModified": 1695108154,
11 "narHash": "sha256-gSg7UTVtls2yO9lKtP0yb66XBHT1Fx5qZSZbGMpSn2c=",
12 "owner": "nix-community",
13 "repo": "home-manager",
14 "rev": "07682fff75d41f18327a871088d20af2710d4744",
15 "type": "github"
16 },
17 "original": {
18 "owner": "nix-community",
19 "ref": "release-23.05",
20 "repo": "home-manager",
21 "type": "github"
22 }
23 },
24 "nixpkgs": {
25 "locked": {
26 "lastModified": 1695559356,
27 "narHash": "sha256-kXZ1pUoImD9OEbPCwpTz4tHsNTr4CIyIfXb3ocuR8sI=",
28 "owner": "nixos",
29 "repo": "nixpkgs",
30 "rev": "261abe8a44a7e8392598d038d2e01f7b33cf26d0",
31 "type": "github"
32 },
33 "original": {
34 "owner": "nixos",
35 "ref": "nixos-23.05",
36 "repo": "nixpkgs",
37 "type": "github"
38 }
39 },
40 "root": {
41 "inputs": {
42 "home-manager": "home-manager",
43 "nixpkgs": "nixpkgs"
44 }
45 }
46 },
47 "root": "root",
48 "version": 7
49}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..7f3d0b9
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,32 @@
1{
2 description = "My nix config";
3 inputs = {
4 nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
5
6 home-manager = {
7 url = "github:nix-community/home-manager/release-23.05";
8 inputs.nixpkgs.follows = "nixpkgs";
9 };
10 };
11
12 outputs = { self, nixpkgs, home-manager, ... }: {
13 nixosConfigurations = {
14 oracle = nixpkgs.lib.nixosSystem {
15 system = "x86_64-linux";
16 modules = [
17 {
18 imports = [ ./hosts/oracle/configuration.nix ];
19 }
20 home-manager.nixosModules.home-manager
21 {
22 home-manager.useGlobalPkgs = true;
23 home-manager.useUserPackages = true;
24 home-manager.users.shubh = {
25 imports = [ ./home.nix ];
26 };
27 }
28 ];
29 };
30 };
31 };
32}
diff --git a/home.nix b/home.nix
new file mode 100644
index 0000000..7de67a9
--- /dev/null
+++ b/home.nix
@@ -0,0 +1,79 @@
1{ config, pkgs, ... }:
2
3{
4 home.username = "shubh";
5 home.homeDirectory = "/home/shubh";
6
7 # You should not change this value, even if you update Home Manager. If you do
8 # want to update the value, then make sure to first check the Home Manager
9 # release notes.
10 home.stateVersion = "23.05";
11
12 home.packages = with pkgs; [
13 git
14 unzip
15 wget
16 gnupg
17 pinentry
18 wl-clipboard
19 pass
20 tmux
21 fzf
22 firefox
23 libreoffice-qt
24 # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
25 ];
26
27 programs.home-manager.enable = true;
28 programs.zsh = {
29 enable = true;
30 enableCompletion = true;
31 shellAliases = {
32 ll = "ls -l";
33 v = "nvim";
34 o = "xdg-open";
35 t = "tmux";
36 update = "sudo nixos-rebuild switch --flake ~/nix";
37 };
38 history = {
39 size = 10000;
40 path = "${config.xdg.dataHome}/zsh/history";
41 };
42 oh-my-zsh = {
43 enable = true;
44 plugins = [ "git" "kubectl" "sudo" ];
45 theme = "robbyrussell";
46 };
47 };
48 programs.fzf = {
49 enable = true;
50 enableZshIntegration = true;
51 defaultOptions = [ "--height 40%" "--layout=reverse" "--border" ];
52 };
53 programs.git = {
54 enable = true;
55 userEmail = "me@ubh.sh";
56 userName = "Shubham Saini";
57 signing = {
58 key = "E0404DDE4BCF9DB5";
59 signByDefault = true;
60 };
61 };
62
63 services.gpg-agent = {
64 enable = true;
65 pinentryFlavor = "qt";
66 };
67
68 xdg = {
69 userDirs = {
70 enable = true;
71 desktop = "\$HOME/desktop";
72 documents = "\$HOME/docs";
73 download = "\$HOME/downloads";
74 pictures = "\$HOME/pics";
75 music = "\$HOME/music";
76 videos = "\$HOME/vids";
77 };
78 };
79}
diff --git a/hosts/oracle/configuration.nix b/hosts/oracle/configuration.nix
new file mode 100644
index 0000000..500906b
--- /dev/null
+++ b/hosts/oracle/configuration.nix
@@ -0,0 +1,91 @@
1{ config, pkgs, ... }:
2
3{
4 imports =
5 [
6 ./hardware-configuration.nix
7 ];
8
9 boot.loader.systemd-boot.enable = true;
10 boot.loader.efi.canTouchEfiVariables = true;
11
12 # swap on luks
13 boot.initrd.secrets = {
14 "/crypto_keyfile.bin" = null;
15 };
16 boot.initrd.luks.devices."luks-5cbabb1a-ed3b-44da-b4c0-894c2265d8c0".device = "/dev/disk/by-uuid/5cbabb1a-ed3b-44da-b4c0-894c2265d8c0";
17 boot.initrd.luks.devices."luks-5cbabb1a-ed3b-44da-b4c0-894c2265d8c0".keyFile = "/crypto_keyfile.bin";
18
19 networking.hostName = "oracle";
20 networking.networkmanager.enable = true;
21
22 time.timeZone = "America/Vancouver";
23 i18n.defaultLocale = "en_CA.UTF-8";
24 sound.enable = true;
25 hardware.pulseaudio.enable = false;
26 hardware.bluetooth.enable = true;
27 security.rtkit.enable = true;
28 programs.zsh.enable = true;
29
30 users.users.shubh = {
31 isNormalUser = true;
32 shell = pkgs.zsh;
33 extraGroups = [ "networkmanager" "wheel" "docker" ];
34 };
35
36 nixpkgs.config.allowUnfree = true;
37
38 environment.systemPackages = with pkgs; [
39 neovim
40 git
41 interception-tools
42 ];
43
44 services = {
45 xserver = {
46 enable = true;
47 layout = "us";
48 displayManager = {
49 sddm.enable = true;
50 defaultSession = "plasmawayland";
51 };
52 desktopManager.plasma5.enable = true;
53 libinput.enable = true;
54 };
55 pipewire = {
56 enable = true;
57 alsa.enable = true;
58 alsa.support32Bit = true;
59 pulse.enable = true;
60 };
61 interception-tools = {
62 enable = true;
63 plugins = with pkgs; [
64 interception-tools-plugins.caps2esc
65 ];
66 udevmonConfig = ''
67 - JOB: "intercept -g $DEVNODE | caps2esc | uinput -d $DEVNODE"
68 - JOB: "${pkgs.interception-tools}/bin/intercept -g $DEVNODE | ${pkgs.interception-tools-plugins.caps2esc}/bin/caps2esc | ${pkgs.interception-tools}/bin/uinput -d $DEVNODE"
69 DEVICE:
70 EVENTS:
71 EV_KEY: [KEY_CAPSLOCK, KEY_ESC]
72 '';
73 };
74 };
75 virtualisation.docker.enable = true;
76
77 nix = {
78 extraOptions = ''
79 experimental-features = nix-command flakes
80 '';
81 };
82
83 # This value determines the NixOS release from which the default
84 # settings for stateful data, like file locations and database versions
85 # on your system were taken. It‘s perfectly fine and recommended to leave
86 # this value at the release version of the first install of this system.
87 # Before changing this value read the documentation for this option
88 # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
89 system.stateVersion = "23.05"; # Did you read the comment?
90
91}
diff --git a/hosts/oracle/hardware-configuration.nix b/hosts/oracle/hardware-configuration.nix
new file mode 100644
index 0000000..1d57a92
--- /dev/null
+++ b/hosts/oracle/hardware-configuration.nix
@@ -0,0 +1,42 @@
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 [ (modulesPath + "/installer/scan/not-detected.nix")
9 ];
10
11 boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usb_storage" "sd_mod" ];
12 boot.initrd.kernelModules = [ ];
13 boot.kernelModules = [ "kvm-amd" ];
14 boot.extraModulePackages = [ ];
15
16 fileSystems."/" =
17 { device = "/dev/disk/by-uuid/84cae4ab-2829-4af1-9fe8-1a57128b1fa1";
18 fsType = "ext4";
19 };
20
21 boot.initrd.luks.devices."luks-8bf40ec5-be29-41f3-97c8-ed6a6beec6d3".device = "/dev/disk/by-uuid/8bf40ec5-be29-41f3-97c8-ed6a6beec6d3";
22
23 fileSystems."/boot" =
24 { device = "/dev/disk/by-uuid/2B72-E7BD";
25 fsType = "vfat";
26 };
27
28 swapDevices =
29 [ { device = "/dev/disk/by-uuid/3815a775-9072-4703-ab1d-267fe1287bf8"; }
30 ];
31
32 # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
33 # (the default) this is the recommended approach. When using systemd-networkd it's
34 # still possible to use this option, but it's recommended to use it in conjunction
35 # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
36 networking.useDHCP = lib.mkDefault true;
37 # networking.interfaces.enp2s0.useDHCP = lib.mkDefault true;
38 # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true;
39
40 nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
41 hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
42}