summaryrefslogtreecommitdiff
path: root/configuration.nix
blob: c55e8afa63622673ad97acb048432e89442059b6 (plain)
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# 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, ... }:

{
    imports =
        [ # Include the results of the hardware scan.
        ./hardware-configuration.nix
        # ./pc_t14.nix
    ];

    boot = {
        # Use the GRUB 2 boot loader.
        loader.grub = {
            enable = true;
            version = 2;
        };
        tmpOnTmpfs = true;
        supportedFilesystems = [ "ntfs" ];
        kernel.sysctl = {
            "kernel.sysrq"=1;
        };
    };

    # Enable sound.
    sound.enable = true;

    hardware = {
        opengl.enable = true;
        enableRedistributableFirmware = true;

        # Thinkpad stuff
        acpilight.enable = true;

        bluetooth.enable = false;

        pulseaudio = {
            enable = true;
            # Stupid but need it to control sound from acpid
            # systemWide = true;

            # Enable bluetooth audio
            package = pkgs.pulseaudioFull;
        };
    };

    networking = {
        # Hostname and wireless enabled
        # set in device specific file

        # wireless.enable = true;

        # The global useDHCP flag is deprecated, therefore explicitly set to false here.
        # Per-interface useDHCP will be mandatory in the future, so this generated config
        # replicates the default behaviour.
        interfaces.enp0s25.useDHCP = true;
        interfaces.wlp3s0.useDHCP = true;

        # Firewall configuration
        # firewall.enable = true; yeah who needs that shit

        networkmanager = {
            enable = true;
        };
    };

    # Select internationalisation properties.
    i18n = {
        defaultLocale = "en_DK.UTF-8";
    };

    console = {
        keyMap = "us";
        font = "Lat2-Terminus16";
    };

    # Set your time zone.
    time.timeZone = "Europe/Copenhagen";

    # Enabled services

    # Enable the OpenSSH daemon.
    # services.openssh.enable = true;

    programs.gnupg.agent = {
        enable = true;
        enableSSHSupport = true;
        pinentryFlavor = "gtk2";
    };
    programs.dconf.enable = true;

    # Enable the X11 windowing system.
    services = {
        xserver = {
            enable = true;
            layout = "us";
            xkbVariant = "altgr-intl";
            exportConfiguration = true;	

            windowManager = {
                i3 = {
                    enable = false;
                    package = pkgs.i3-gaps;
                };
                qtile.enable = false;
            };

            displayManager = {
                defaultSession = "none+script";
                session = [{
                    name = "script";
                    manage = "window";
                    start = 
                    ''
                        /home/julian/.nixxstart
                    '';
                }];
            };

            desktopManager = {
                xterm.enable = false;
            };

            # Touchpad studd
            libinput.enable = true;

            # Start dbus?
            startDbusSession = true;
        };
        # Auto mounting
        gvfs.enable = true;

        # Yubikey
        pcscd.enable = true;

        # Thinkpad
        acpid = {
            enable = true;
            # Turn down sound when inserting headphones
            handlers = {
                headphone = {
                    action = 
                    ''
                    vals=($1)
                    case ''${vals[2]} in
                    plug)
                    whoami >> /tmp/acpi.log
                    amixer set Master 10%
                    ;;
                    esac
                    '';
                    event = "jack/headphone.*";
                };
            };
        };
        tlp.enable = true;

        # Evolution
        gnome3 = {
            gnome-keyring.enable = true;
            evolution-data-server.enable = true;
        };

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

        # blueman.enable = true;

        postgresql = {
            enable = false;
            initialScript = pkgs.writeText "backend-initScript" ''
                CREATE ROLE julian WITH LOGIN PASSWORD 'hejmeddig' CREATEDB;
                CREATE DATABASE julian;
                GRANT ALL PRIVILEGES ON DATABASE julian TO julian;
            '';
        };
    };

    # Define a user account. Don't forget to set a password with ‘passwd’.
    users.users.julian = {
        isNormalUser = true;
        shell = pkgs.zsh;
        extraGroups = [ "wheel" "video" ];
    };

    virtualisation.docker = {
        enable = false;
    };


    # This value determines the NixOS release with which your system is to be
    # compatible, in order to avoid breaking some software such as database
    # servers. You should change this only after NixOS release notes say you
    # should.
    system.stateVersion = "20.09"; # Did you read the comment?

    fonts.fonts = with pkgs; [
        noto-fonts noto-fonts-emoji liberation_ttf ubuntu_font_family cozette
    ];

    # List packages installed in system profile. To search, run:
    # $ nix search wget
    nixpkgs.config.allowUnfree = true;
    environment = {
        etc = {
            "docker/daemon.json".text = ''
                { "dns": [ "1.1.1.1", "9.9.9.9" ] }
            '';
        };
        systemPackages = with pkgs; [
            # General stuff
            wget vim neovim git htop zsh stow pass tree dnsutils gnupg zip
            unzip gopass tig file imagemagick whois nmap usbutils lshw gnumake
            aspell aspellDicts.da aspellDicts.en pv acpi jq killall netcat-gnu perl gopass
            cowsay gdb man-pages sox

            # Landuage support
            rustup gcc binutils python3 python go clang-tools

            # Network stuff
            networkmanagerapplet networkmanager-openconnect iw batctl
            wirelesstools

            # X stuff
            feh xscreensaver dmenu rofi xorg.xmodmap xss-lock xclip
            acpilight xdotool dunst xcompmgr scrot libnotify i3lock

            # Gui applications
            firefox pavucontrol okular leafpad inkscape gimp 
            meld pinentry gnome3.gnome-system-monitor gnome3.dconf
            termite quasselClient wireshark spotify
            gnome3.file-roller gnome3.gnome-calculator 
            gnome3.simple-scan vlc mpv xorg.xev gnome3.evolution 
            evolution-data-server vimHugeX tor-browser-bundle-bin
            (mumble.override { pulseSupport = true; })
            libreoffice-fresh liferea qutebrowser

            # Other stuff
            # texlive.combined.scheme-full biber
            youtube-dl sshpass

            # Hardware stuff. X230 and T14
            linuxPackages.acpi_call
        ];
    };
}