summaryrefslogtreecommitdiff
path: root/rootless-nixos/configuration.nix
blob: 6e2a2d34f4878b7b7342d66ba7d859e3299c9eac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, lib, ... }:

let
  home-manager = builtins.fetchTarball "https://github.com/nix-community/home-manager/archive/refs/heads/release-22.11.tar.gz";
in

{
  imports = [
    (import "${home-manager}/nixos")
  ];

  boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ "kvm-intel" ];
  boot.extraModulePackages = [ ];

  boot.loader.grub.enable = true;
  boot.loader.grub.device = "nodev";
  #boot.loader.grub.extraGrubInstallArgs = [ "--bootloader-id=NixOS" ];
  boot.loader.efi.efiSysMountPoint = "/dev/efi";
  boot.loader.efi.canTouchEfiVariables = true;

  fileSystems."/" =
    { device = "tmpfs";
      fsType = "tmpfs";
    };

  fileSystems."/boot" =
    { device = "/dev/disk/by-uuid/c4cac70a-3179-4063-9865-65cc1a6314c6";
      fsType = "ext4";
    };

  fileSystems."/boot/efi" =
    { device = "/dev/disk/by-uuid/ADB6-2084";
      fsType = "vfat";
    };

  fileSystems."/nix" =
    { device = "/dev/disk/by-uuid/81ddfb59-2f8d-4a49-8ed2-1ca2dbf08d0d";
      fsType = "ext4";
    };

  fileSystems."/data" =
    { device = "/dev/disk/by-uuid/c696ab13-8d36-4ed6-b965-eba15c3b28f4";

      fsType = "ext4";
    };

  swapDevices = [ ];

  networking.useDHCP = lib.mkDefault true;

  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
  hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;

  networking.hostName = "nixos"; # Define your hostname.
  # Pick only one of the below networking options.
  # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.
  # networking.networkmanager.enable = true;  # Easiest to use and most distros use this by default.

  time.timeZone = "Europe/Paris";

  i18n.defaultLocale = "en_US.UTF-8";
  console = {
    font = "sun12x22";
    keyMap = "fr";
  #   useXkbConfig = true; # use xkbOptions in tty.
  };

  # Enable the X11 windowing system.
  services.xserver.enable = true;

  # Enable the GNOME Desktop Environment.
  services.xserver.displayManager.sx.enable = true;
  services.xserver.windowManager.icewm.enable = true;
  

  # Configure keymap in X11
  services.xserver.layout = "fr";
  services.xserver.xkbOptions = "eurosign:e,caps:escape";

  # Enable CUPS to print documents.
  # services.printing.enable = true;

  # Enable sound.
  # sound.enable = true;
  # hardware.pulseaudio.enable = true;

  # Enable touchpad support (enabled default in most desktopManager).
  # services.xserver.libinput.enable = true;

  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users.lx = {
    uid = 1000;
    isNormalUser = true;
    extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
    hashedPassword = "$y$j9T$MYbKJrmirtHLq3yd9V9jr1$UDcCp29ovu3waapi6229..k2b1qnkeLMfWe0Jwx1b64";
  };
  users.users.root.hashedPassword = "$y$j9T$5rD5qq5OkV3ap8Z3ZQKqO/$QzyG/NnbqX29QTKVaGgRhiVYu3kzU.jaGzNIPSYKjQ8";
  users.mutableUsers = false;

  home-manager.users.lx = {
    home.file = {
      ".ssh/config".source = ../ssh/config;
      ".config/tmux/tmux.conf".source = ../tmux/tmux.conf;
      ".vim/swp/emptydir".text = "";
      ".vim/backup/emptydir".text = "";
      ".config/sx/sxrc" = {
        text = ''
          setxkbmap fr
          ${pkgs.icewm}/bin/icewm-session
        '';
        executable = true;
      };
      ".config/icewm/preferences".text = ''
        TerminalCommand="st"
      '';
      ".config/icewm/keys".text = ''
        key "Super+Enter" st -f monospace-12pt
      '';
    };
    programs.vim = {
      enable = true;
      extraConfig = (builtins.readFile ../vim/vimrc);
      plugins = with pkgs.vimPlugins; [ vim-nix fzf-vim nerdtree vim-go ];
    };
    home.stateVersion = "22.11";
  };

  environment.systemPackages = with pkgs; [
    # CLI
    vim
    wget
    gnumake
    htop
    git
    tmux

    # GUI
    st
    dillo
    links2
    pcmanfm
    qutebrowser
    netsurf.browser
  ];
  programs.vim.defaultEditor = true;

  # services.openssh.enable = true;

  # networking.firewall.allowedTCPPorts = [ ... ];
  # networking.firewall.allowedUDPPorts = [ ... ];

  system.copySystemConfiguration = true;

  system.stateVersion = "22.11";

}