From 939e7645b8a741077113cafbc37df64ab69f8141 Mon Sep 17 00:00:00 2001 From: wexocam Date: Fri, 22 May 2026 14:25:24 +0200 Subject: [PATCH 1/2] feat(noctalia): add idleEnabled toggle option Exposes idle.enabled as a wrapper-module option (default true, preserves current behavior) so it can be flipped without editing the wrapper. Co-Authored-By: Claude Opus 4.7 (1M context) --- modules/wrappedPrograms/noctalia.nix | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/modules/wrappedPrograms/noctalia.nix b/modules/wrappedPrograms/noctalia.nix index e10228cc..ce10cfca 100644 --- a/modules/wrappedPrograms/noctalia.nix +++ b/modules/wrappedPrograms/noctalia.nix @@ -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 = { @@ -293,7 +301,7 @@ }; idle = { - enabled = true; + enabled = config.idleEnabled; screenOffTimeout = 300; lockTimeout = 330; suspendTimeout = 0; From c05012ec2fa6b39377eb9f8f3bf9310247202f46 Mon Sep 17 00:00:00 2001 From: wexocam Date: Fri, 22 May 2026 14:25:38 +0200 Subject: [PATCH 2/2] feat(templates): add C and Haskell flake templates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds nix flake templates for C (stdenv.mkDerivation + Makefile, gcc/clang toolchain devShell) and Haskell (callCabal2nix + cabal-install/HLS devShell). C# remains pending — buildDotnetModule needs a generated deps.json which can't be produced ahead of project content. Co-Authored-By: Claude Opus 4.7 (1M context) --- TODO.md | 4 +- modules/templates/_c/LICENSE | 23 +++++++++++ modules/templates/_c/Makefile | 9 +++++ modules/templates/_c/README.md | 11 +++++ modules/templates/_c/flake.nix | 40 +++++++++++++++++++ modules/templates/_c/main.c | 6 +++ modules/templates/_haskell/LICENSE | 23 +++++++++++ modules/templates/_haskell/README.md | 11 +++++ modules/templates/_haskell/app/Main.hs | 4 ++ modules/templates/_haskell/flake.nix | 35 ++++++++++++++++ .../templates/_haskell/sample-project.cabal | 13 ++++++ modules/templates/templates.nix | 37 +++++++++++++++++ 12 files changed, 214 insertions(+), 2 deletions(-) create mode 100644 modules/templates/_c/LICENSE create mode 100644 modules/templates/_c/Makefile create mode 100644 modules/templates/_c/README.md create mode 100644 modules/templates/_c/flake.nix create mode 100644 modules/templates/_c/main.c create mode 100644 modules/templates/_haskell/LICENSE create mode 100644 modules/templates/_haskell/README.md create mode 100644 modules/templates/_haskell/app/Main.hs create mode 100644 modules/templates/_haskell/flake.nix create mode 100644 modules/templates/_haskell/sample-project.cabal diff --git a/TODO.md b/TODO.md index 134581f7..7aa38b08 100644 --- a/TODO.md +++ b/TODO.md @@ -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 diff --git a/modules/templates/_c/LICENSE b/modules/templates/_c/LICENSE new file mode 100644 index 00000000..8d4d0b42 --- /dev/null +++ b/modules/templates/_c/LICENSE @@ -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. + + diff --git a/modules/templates/_c/Makefile b/modules/templates/_c/Makefile new file mode 100644 index 00000000..d3a94236 --- /dev/null +++ b/modules/templates/_c/Makefile @@ -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 diff --git a/modules/templates/_c/README.md b/modules/templates/_c/README.md new file mode 100644 index 00000000..2befecc4 --- /dev/null +++ b/modules/templates/_c/README.md @@ -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. diff --git a/modules/templates/_c/flake.nix b/modules/templates/_c/flake.nix new file mode 100644 index 00000000..f382b9b9 --- /dev/null +++ b/modules/templates/_c/flake.nix @@ -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 + ]; + }; + }; + }; +} diff --git a/modules/templates/_c/main.c b/modules/templates/_c/main.c new file mode 100644 index 00000000..88562456 --- /dev/null +++ b/modules/templates/_c/main.c @@ -0,0 +1,6 @@ +#include + +int main(void) { + puts("Hello, World!"); + return 0; +} diff --git a/modules/templates/_haskell/LICENSE b/modules/templates/_haskell/LICENSE new file mode 100644 index 00000000..8d4d0b42 --- /dev/null +++ b/modules/templates/_haskell/LICENSE @@ -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. + + diff --git a/modules/templates/_haskell/README.md b/modules/templates/_haskell/README.md new file mode 100644 index 00000000..29c2e337 --- /dev/null +++ b/modules/templates/_haskell/README.md @@ -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. diff --git a/modules/templates/_haskell/app/Main.hs b/modules/templates/_haskell/app/Main.hs new file mode 100644 index 00000000..98f25e48 --- /dev/null +++ b/modules/templates/_haskell/app/Main.hs @@ -0,0 +1,4 @@ +module Main where + +main :: IO () +main = putStrLn "Hello, World!" diff --git a/modules/templates/_haskell/flake.nix b/modules/templates/_haskell/flake.nix new file mode 100644 index 00000000..1af92efe --- /dev/null +++ b/modules/templates/_haskell/flake.nix @@ -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 + ]; + }; + }; + }; +} diff --git a/modules/templates/_haskell/sample-project.cabal b/modules/templates/_haskell/sample-project.cabal new file mode 100644 index 00000000..149e8979 --- /dev/null +++ b/modules/templates/_haskell/sample-project.cabal @@ -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 diff --git a/modules/templates/templates.nix b/modules/templates/templates.nix index 2b7bd0a7..090f26b8 100644 --- a/modules/templates/templates.nix +++ b/modules/templates/templates.nix @@ -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."; @@ -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.";