summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2022-02-21 21:54:09 +0100
committerKarel Kočí <cynerd@email.cz>2022-02-21 22:07:43 +0100
commit6a039e268369f7e9055e19d733849da26ab0208b (patch)
treebdda334bf9ccddf145985a4cbe45cc562c98e7c1
downloadnix-openrc-6a039e268369f7e9055e19d733849da26ab0208b.tar.gz
nix-openrc-6a039e268369f7e9055e19d733849da26ab0208b.tar.bz2
nix-openrc-6a039e268369f7e9055e19d733849da26ab0208b.zip
Add OpenRC
-rw-r--r--.gitignore1
-rw-r--r--flake.lock40
-rw-r--r--flake.nix21
-rw-r--r--nixos/default.nix2
-rw-r--r--pkgs/default.nix13
-rw-r--r--pkgs/openrc/default.nix37
6 files changed, 114 insertions, 0 deletions
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 ? <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"
+ ];
+}