From 6a039e268369f7e9055e19d733849da26ab0208b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Mon, 21 Feb 2022 21:54:09 +0100 Subject: Add OpenRC --- .gitignore | 1 + flake.lock | 40 ++++++++++++++++++++++++++++++++++++++++ flake.nix | 21 +++++++++++++++++++++ nixos/default.nix | 2 ++ pkgs/default.nix | 13 +++++++++++++ pkgs/openrc/default.nix | 37 +++++++++++++++++++++++++++++++++++++ 6 files changed, 114 insertions(+) create mode 100644 .gitignore create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 nixos/default.nix create mode 100644 pkgs/default.nix create mode 100644 pkgs/openrc/default.nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fcfc4a1 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +result* diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..fd330a2 --- /dev/null +++ b/flake.lock @@ -0,0 +1,40 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1644229661, + "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", + "type": "github" + }, + "original": { + "id": "flake-utils", + "type": "indirect" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1645013224, + "narHash": "sha256-b7OEC8vwzJv3rsz9pwnTX2LQDkeOWz2DbKypkVvNHXc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b66b39216b1fef2d8c33cc7a5c72d8da80b79970", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..47ed1ad --- /dev/null +++ b/flake.nix @@ -0,0 +1,21 @@ +{ + description = "OpenRC flake"; + + outputs = { self, nixpkgs, flake-utils }: + let + flakelib = flake-utils.lib; + in { + overlay = final: prev: import ./pkgs { nixpkgs = prev; }; + nixosModules = import ./nixos; + nixosModule = { + imports = builtins.attrValues self.nixosModules; + nixpkgs.overlays = [ self.overlay ]; + }; + } // flakelib.eachDefaultSystem (system: { + packages = import nixpkgs { + inherit system; + overlays = [ self.overlay ]; + crossOverlays = [ self.overlay ]; + }; + }); +} diff --git a/nixos/default.nix b/nixos/default.nix new file mode 100644 index 0000000..2c63c08 --- /dev/null +++ b/nixos/default.nix @@ -0,0 +1,2 @@ +{ +} diff --git a/pkgs/default.nix b/pkgs/default.nix new file mode 100644 index 0000000..464c468 --- /dev/null +++ b/pkgs/default.nix @@ -0,0 +1,13 @@ +{ nixpkgs ? , nixlib ? nixpkgs.lib }: + +let + pkgs = nixpkgs // openrcpkgs; + callPackage = nixlib.callPackageWith pkgs; + + openrcpkgs = with pkgs; { + + openrc = callPackage ./openrc { }; + + }; + +in openrcpkgs diff --git a/pkgs/openrc/default.nix b/pkgs/openrc/default.nix new file mode 100644 index 0000000..8c235e0 --- /dev/null +++ b/pkgs/openrc/default.nix @@ -0,0 +1,37 @@ +{ stdenv, lib, fetchgit +, meson, ninja, pkg-config +, pam, ncurses +}: + +stdenv.mkDerivation rec { + pname = "openrc"; + version = "0.44.10"; + meta = with lib; { + homepage = "https://github.com/OpenRC/openrc"; + description = "OpenRC manages the services, startup and shutdown of a host"; + platforms = with platforms; linux; + license = licenses.bsd2; + }; + + src = fetchgit { + url = "https://github.com/OpenRC/openrc.git"; + rev = version; + sha256 = "0azb3ywclzx6cz9bmfpc4aqysz1pq4akr882bvnqh2x78xixcydv"; + }; + + nativeBuildInputs = [ meson ninja pkg-config ]; + buildInputs = [ pam ncurses ]; + + preConfigure = "export DESTDIR=/"; + mesonFlags = [ + "-Dbranding=\"NIXOS\"" + "-Dos=Linux" + "-Dselinux=disabled" + "-Daudit=disabled" + "-Dsysvinit=false" + "-Dtermcap=ncurses" + "-Dnewnet=true" + "-Drootprefix=${placeholder "out"}" + "--sysconfdir=${placeholder "out"}/etc" + ]; +} -- cgit v1.2.3