Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ to implement a template for each language I use, which, as of now consists of:
- [x] Rust
- [x] Go
- [ ] C#
- [ ] Haskell
- [ ] C
- [x] Haskell
- [x] C
- [x] Python
23 changes: 23 additions & 0 deletions modules/templates/_c/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
MIT License

Copyright (c) 2026 Bastian Asmussen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


9 changes: 9 additions & 0 deletions modules/templates/_c/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CC := gcc
CFLAGS := -O2 -Wall -Wextra -Wpedantic -std=c11

sample-project: main.c
$(CC) $(CFLAGS) -o $@ $<

.PHONY: clean
clean:
rm -f sample-project
11 changes: 11 additions & 0 deletions modules/templates/_c/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# C Project Template

## Intended Usage

Development of C programs and libraries.

## Getting Started

- Enter the development shell with `nix develop`.
- Build with `make` or `nix build`.
- Rename `sample-project` in `Makefile` and `flake.nix` to your project name.
40 changes: 40 additions & 0 deletions modules/templates/_c/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
description = "C development environment.";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
};

outputs =
inputs@{
flake-parts,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" ];
perSystem =
{ pkgs, ... }:
{
packages.default = pkgs.stdenv.mkDerivation {
pname = "sample-project";
version = "0.1.0";
src = ./.;

installPhase = ''
install -Dm755 sample-project $out/bin/sample-project
'';
};

devShells.default = pkgs.mkShell {
packages = with pkgs; [
gcc
gnumake
gdb
clang-tools
valgrind
];
};
};
};
}
6 changes: 6 additions & 0 deletions modules/templates/_c/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <stdio.h>

int main(void) {
puts("Hello, World!");
return 0;
}
23 changes: 23 additions & 0 deletions modules/templates/_haskell/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
MIT License

Copyright (c) 2026 Bastian Asmussen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


11 changes: 11 additions & 0 deletions modules/templates/_haskell/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Haskell Project Template

## Intended Usage

Development of Haskell programs and libraries.

## Getting Started

- Enter the development shell with `nix develop`.
- Build with `cabal build` or `nix build`.
- Rename `sample-project` in `sample-project.cabal` and `flake.nix` to your project name.
4 changes: 4 additions & 0 deletions modules/templates/_haskell/app/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Main where

main :: IO ()
main = putStrLn "Hello, World!"
35 changes: 35 additions & 0 deletions modules/templates/_haskell/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
description = "Haskell development environment.";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
};

outputs =
inputs@{
flake-parts,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" ];
perSystem =
{ pkgs, ... }:
let
hp = pkgs.haskellPackages;
pkg = hp.callCabal2nix "sample-project" ./. { };
in
{
packages.default = pkg;

devShells.default = hp.shellFor {
packages = _: [ pkg ];
nativeBuildInputs = with hp; [
cabal-install
haskell-language-server
ghcid
];
};
};
};
}
13 changes: 13 additions & 0 deletions modules/templates/_haskell/sample-project.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cabal-version: 2.4
name: sample-project
version: 0.1.0.0
synopsis: Sample Haskell project.
license: MIT
build-type: Simple

executable sample-project
main-is: Main.hs
hs-source-dirs: app
build-depends: base >=4.14 && <5
default-language: Haskell2010
ghc-options: -Wall
37 changes: 37 additions & 0 deletions modules/templates/templates.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
{
flake.templates = rec {
default = rust;

c = {
path = ./_c;
description = "C development environment.";
welcomeText = ''
# C Project Template

## Intended Usage

Development of C programs and libraries.

## Getting Started

- Enter the development shell with `nix develop`.
- Build with `make` or `nix build`.
- Rename `sample-project` in `Makefile` and `flake.nix` to your project name.
'';
};

go = {
path = ./_go;
description = "Go development environment.";
Expand All @@ -21,6 +40,24 @@
'';
};

haskell = {
path = ./_haskell;
description = "Haskell development environment.";
welcomeText = ''
# Haskell Project Template

## Intended Usage

Development of Haskell programs and libraries.

## Getting Started

- Enter the development shell with `nix develop`.
- Build with `cabal build` or `nix build`.
- Rename `sample-project` in `sample-project.cabal` and `flake.nix` to your project name.
'';
};

python = {
path = ./_python;
description = "Python development environment.";
Expand Down
18 changes: 13 additions & 5 deletions modules/wrappedPrograms/noctalia.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,18 @@
...
}:
{
options.videoDir = lib.mkOption {
type = lib.types.str;
default = "/home/${inputs.nix-secrets.user.name}/Videos";
description = "Directory noctalia's screen recorder writes to.";
options = {
videoDir = lib.mkOption {
type = lib.types.str;
default = "/home/${inputs.nix-secrets.user.name}/Videos";
description = "Directory noctalia's screen recorder writes to.";
};

idleEnabled = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Whether the idle service turns off displays and locks the session after the configured timeouts.";
};
};

config = {
Expand Down Expand Up @@ -293,7 +301,7 @@
};

idle = {
enabled = true;
enabled = config.idleEnabled;
screenOffTimeout = 300;
lockTimeout = 330;
suspendTimeout = 0;
Expand Down